Object Reference Error only occurring on one scene

im getting these errors ine debug log, but only one scene two of the project booth lesson, no error when colliding with an object in scene one, and the effects both trigger each time the errors "NullReferenceException: Object reference not set to an instance of an object
CollisionHandler.StartCrashSequence () (at Assets/Scripts/CollisionHandler.cs:55)
CollisionHandler.OnCollisionEnter (UnityEngine.Collision other) (at Assets/Scripts/CollisionHandler.cs:34)
"
"NullReferenceException: Object reference not set to an instance of an object
CollisionHandler.StartSuccessSequence () (at Assets/Scripts/CollisionHandler.cs:44)
CollisionHandler.OnCollisionEnter (UnityEngine.Collision other) (at Assets/Scripts/CollisionHandler.cs:31)

"

Hi,

Please note, it’s better to copy/paste your code and apply the code fencing characters, rather than using screenshots. Screenshots are ideal for displaying specific details from within a game engine editor or even error messages, but for code, they tend to be less readable, especially on mobile devices which can require extensive zooming and scrolling.

You also prevent those that may offer to help you the ability to copy/paste part of your code back to you with suggestions and/or corrections, meaning that they would need to type a potentially lengthy response. You will often find that people are more likely to respond to your questions if you make it as easy as possible for them to do so.

Regarding your problem, NullReferenceException means that a reference (“link”) to an instance is missing. Double click on the error message to see to which line in your code it is referring. If you exposed a field in the Inspector, make sure that it’s not empty.

Hope this helps :slight_smile:


See also;

1 Like

Thank you for the help, I believe it was an issue with that individual scene, I deleted it, then duplicated the one not throwing the error and it stopped, to further test it a repeated it with a third scene. next time I run into that error or any others ill be sure to copy paste not screen cap.

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

Privacy & Terms