Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

EventSystem Null ref error: Am I the only one?

Discussion in 'UGUI & TextMesh Pro' started by JtheSpaceC, Dec 4, 2014.

  1. JtheSpaceC

    JtheSpaceC

    Joined:
    Oct 5, 2014
    Posts:
    14
    I posted this in Answers a week ago but got no answers. As far as I can tell nobody else is having this problem. Or are they?

    I'm having a problem just since installing 4.6, that I didn't have with 4.6 Beta. I'm in the testing phase of my game so for convenience, instead of restarting a scene by clicking play twice, I have the following in a script:

    1. //FOR TESTING ONLY
    2. if(Input.GetButton("Restart"))
    3. {
    4. Application.LoadLevel(Application.loadedLevel);
    5. }
    "Restart" is set to 'r' in the Input manager. I'm using UI elements in my levels, so I have an EventSystem in each scene. Before the newest install, I could restart perfectly with no errors but now I get the following when I press it:


    I don't know what to do about it. I tried putting the EventSystem on a gameobject and instantiating that object at the start of the level, and I also tried putting it on an object that uses "DontDestroyOnLoad(this.gameobject)" but even then it won't restart without an error.

    If I remove the event system (so my buttons aren't clickable) I don't get the error, but what good is that?

    Right now the event system is in the scene's hierarchy (not instantiated), IS destroyed on load, and that error is thrown up as soon as I press "Restart", but it'll run the initial level just fine, until I restart. Any ideas?

    Thanks Kevin