Yet another event System reference error... Cant find event system in scenes?

So I realize my issue is that I do not have an event system in my scene… I just cant figure out how to get one to add to my scene… Maybe I missed in the videos… but I’m kind of lost…
I tried creating one in InteractWithUI()…

   private bool InteractWithUI()
        {
            EventSystem eventSystem = new EventSystem();
            return EventSystem.current.IsPointerOverGameObject();

        }

but that, obviously didn’t work (EventSystem.EventSystem() is inaccessible due to it being Private… Im probably overlooking something really simple. But, I’ve been working on this since last night and cant find the answer.

Information I have found says the Event system is added automatically when a UI Element is added to the scene… but I got nothing.
However, I realized that I had nested the UI under the “PlayerCharacter” prefab, So no matter where I put the character the UI would be in the scene… Could this be the issue?

I added another canvas to the scene, and it created an Event System for me, but I am still getting the reference error…

@Brian_Trotter I saw your post here:

and tried this. I created the event system, both by creating a new canvas, and by creating an empty object adding an event system component, and clicked the Add Default Input Module button.
Neither solution worked. I am not using any mobile input, however, my UI design is different than the course, and my hierarchy is organized slightly differently.

Are you using the old Input system or the new Input system?

Do your canvases have a Graphics Raycaster on them?

It really doesn’t matter where the EventSystem is, as long as there is exactly one.

Thanks for the reply!
However, after much experimenting with rebuilding a whole new UI, I got the Reference Error to go away, and the Event System to register, however, that wasn’t working, until I figured out I wasn’t returning from update, appropriately. Seems to be working now! Thanks!

Edit: It was definitely something to do with the Event system not registering correctly. Now that I have added it to my persistent objects prefab, my old UI is working fine!

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms