Skip to content

Conversation

emre2345
Copy link

@emre2345 emre2345 commented Aug 4, 2025

Embedded event system is deactivate in the case below:

  1. I load a scene additive which does not have any EventSystem
  2. This triggers OnSceneLoaded method in EventSystemHandler
  3. I unload the old scene
  4. This triggers OnSceneUnLoaded method in EventSystemHandler and thus triggers DeactivateEventSystem method.

@yasirkula
Copy link
Owner

In this setup, if I switch from scene A to scene B using LoadScene and if scene A doesn't have an EventSystem while scene B has one, I get "There are 2 event systems in the scene. Please ensure there is always exactly one event system in the scene" warning spam in the Console on Unity 2021.3.41f1.

This warning is logged in both EventSystem.Update and EventSystem.OnEnable (if UIElements Module is enabled). So Unity makes it very hard to avoid both this warning and the edge case you're having. OnEnable is called as soon as a scene is loaded so we must have the EventSystem disabled before the scene is loaded to avoid the warning in OnEnable. That was my motivation for calling DeactivateEventSystem in OnSceneUnloaded.

I don't know how to resolve this issue perfectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants