EventSystems not autoadding

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Mackerel_Sky
Posts: 111
Joined: Mon Apr 08, 2019 8:01 am

EventSystems not autoadding

Post 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
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: EventSystems not autoadding

Post 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.
Mackerel_Sky
Posts: 111
Joined: Mon Apr 08, 2019 8:01 am

Re: EventSystems not autoadding

Post 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.
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: EventSystems not autoadding

Post 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?
Mackerel_Sky
Posts: 111
Joined: Mon Apr 08, 2019 8:01 am

Re: EventSystems not autoadding

Post 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.
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: EventSystems not autoadding

Post 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.)
Mackerel_Sky
Posts: 111
Joined: Mon Apr 08, 2019 8:01 am

Re: EventSystems not autoadding

Post 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.
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: EventSystems not autoadding

Post by Tony Li »

Sounds good. Glad it's working now at least.
Post Reply