Page 1 of 1

EventSystems not autoadding

Posted: Sat Mar 14, 2020 9:06 am
by Mackerel_Sky
Hi,

I've recently started implementing a boss character into my project, and for some reason Dialogue System isn't automatically adding in an EventSystem on the room loading?

I get a notification mentioning that it didn't detect an EventSystem object and was adding one in, but for some reason two of my newer scenes don't have this functionality on. I only realised it when I added some dialogue choices in but found I couldn't select anything.

Is there something I have to do or a prerequisite to have the system fill it in?

Thanks

Re: EventSystems not autoadding

Posted: Sat Mar 14, 2020 11:26 am
by Tony Li
Hi,

The diaogue UI and quest log window will both check for an EventSystem and add one if it's missing -- but only if the "Add EventSystem If Missing" checkbox is ticked. Make sure this checkbox is ticked on at least one of these UIs.

Re: EventSystems not autoadding

Posted: Sat Mar 14, 2020 7:34 pm
by Mackerel_Sky
Hey Tony,

It seems like it's already been ticked on the dialogue UI, but it still doesn't add an EventSystem on loading certain levels. Could something be blocking or spoofing the check somehow? Either way it's not a huge issue because I can just add an EventSystem in the editor, but it would be nice to find out why.

Re: EventSystems not autoadding

Posted: Sun Mar 15, 2020 12:26 am
by Tony Li
Are there any errors or warnings in the Console?

At runtime, is the EventSystem GameObject added to the scene, but it just doesn't accept input?

If it's not there at all, is it possible that something else is deleting it?

Re: EventSystems not autoadding

Posted: Sun Mar 15, 2020 6:58 am
by Mackerel_Sky
Normally it will say something in the console when it adds an EventSystem GameObject, but for some reason it doesn't do so in some scenes. The gameObject does not show up at all on the objects list.

Re: EventSystems not autoadding

Posted: Sun Mar 15, 2020 9:34 am
by Tony Li
Mackerel_Sky wrote: Sun Mar 15, 2020 6:58 am Normally it will say something in the console when it adds an EventSystem GameObject, but for some reason it doesn't do so in some scenes. The gameObject does not show up at all on the objects list.
That suggests one of two things is happening:

1. It isn't doing the check, or

2. It checks and finds an EventSystem. But something later then destroys the EventSystem.

You can get a little more info by editing Assets / Plugins / Pixel Crushers / Dialogue System / Scripts / UI / Utility / UITools.cs.

The RequireEventSystem() method starts on line 19. Add the 2 lines indicated below:

Code: Select all

public static void RequireEventSystem()
{
    Debug.Log("Dialogue System is checking for an EventSystem in the scene."); //<--ADD THIS.
    var eventSystem = GameObject.FindObjectOfType<UnityEngine.EventSystems.EventSystem>();
    if (eventSystem != null) Debug.Log("Dialogue System found an EventSystem in the scene."); //<--ADD THIS.
    if (eventSystem == null)
    {
    ...
Also, make sure your Dialogue Manager's Debug Level is set to Warnings. (Info is also OK, but it logs a lot of extra spam.)

Re: EventSystems not autoadding

Posted: Mon Mar 16, 2020 6:05 am
by Mackerel_Sky
For some reason it started working again when I opened my project today :Y.

Not sure why this is the case, but I'll keep an eye on things in case it comes back.

Re: EventSystems not autoadding

Posted: Mon Mar 16, 2020 8:16 am
by Tony Li
Sounds good. Glad it's working now at least.