Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

What's going on with Eventsystem?

Discussion in 'UGUI & TextMesh Pro' started by Kylotan, Dec 23, 2021.

  1. Kylotan


    Feb 17, 2011
    I'm having a lot of trouble getting my UGUI and the new Input system to cooperate, and one of the common fixes to stop click events being double registered (i.e. once by UGUI, once by an InputAction) is to use the EventSystem to see if the pointer is over the UI before processing it, the same way we had to do with the old input system.

    Problem is, it looks like the documentation on the EventSystem has vanished since I last used it.

    Here it is, in 2018.1:

    But if you search the latest docs, it's just not there:

    I saw a thread that suggested this was because UGUI was migrated out to a package. Okay. So I look at the docs there, and it's just a cursory summary of the public fields, useless for describing the behaviour or usage:

    Yet this forum is full of people still using EventSystem.current.IsPointerOverGameObject and other similar methods, which are now essentially hidden and undocumented.

    What's going on? Is this being deprecated? Or did Unity just decide to migrate it to a package and trash all the documentation in the process?

    Or is there some other way that the new input system is supposed to know not to raise its own event if UGUI is going to handle it? And are there docs on that?
  2. Michael_Swan


    Aug 24, 2021
    Late reply, but I think you just use EventSystem.current. I think EventSystem.current updates to the eventsystem being used in your scene - ie if you have multiple eventsystems in different scenes and do a scene load add, then which is the right EventSystem? EventSystem.current handles that for you, so use EventSystem.current in your code -
    Don't do this:
    EventSystem _eventSystem = EventSystem.current.

    _eventSystem.(something) <= could be a dead eventsystem. Always use current.