Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by JtheSpaceC · Nov 28, 2014 at 08:31 PM · uieventsystem4.6restartapplication.loadlevel

EventSystem causes a NullRef error on restarting a level

Hi. 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:

         //FOR TESTING ONLY
         if (Input.GetButton ("Restart"))
         {
             Application.LoadLevel(Application.loadedLevel);
         }

"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: alt text

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.

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

null ref event system.png (40.0 kB)
Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image JtheSpaceC · Dec 07, 2014 at 11:39 AM 0
Share

nobody else have this? I've created blank new projects and still get it, so I don't think I should be the only one with it..

avatar image Baste · Dec 07, 2014 at 12:44 PM 0
Share

Is the code posted there the line that causes the exception?

Also, if you can do this with a blank project and one script, could you paste that script to pastebin or something like that?

avatar image JtheSpaceC · Dec 07, 2014 at 12:51 PM 0
Share

The line that causes the error is that one (or whatever similar version I use to reload the level within runtime). Can also get it with Application.LoadLevel(0) for example. And it's not that the line causes the error, but when the scene is reloaded successfully, the error is there because the new Event System in the scene doesn't seem to know what it's doing.

In a blank project I can replicate the error with just a single UI button in the scene, and I restart by either clicking the button or pressing the 'r' key. Same error. Pastebin here for the full script in a new project.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by unimechanic · Dec 09, 2014 at 03:52 PM

In a blank project I can replicate the error with just a single UI button in the scene, and I restart by either clicking the button or pressing the 'r' key. Same error.

Please submit a bug report with the minimal sample project that you created:

http://blogs.unity3d.com/2009/04/15/bug-reporting-and-you/

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Unity 4.6 UI Events Stop working 0 Answers

EventSystem - all touches have the same ID 3 Answers

4.6 UI Change what 'Spacebar' is doing by default 1 Answer

UI Navigation on Fire TV 1 Answer

Application.LoadLevel and particle system 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges