Question by
Alheira · Jun 26, 2017 at 08:47 PM ·
scripting problemnullreferenceexceptionroguelike
Null Reference Exception on an unused script
Hi, I'm following a tutorial (the Roguelike 2D tutorial) and I keep getting this error
NullReferenceException: Object reference not set to an instance of an object
Completed.GameManager.OnSceneLoaded (Scene arg0, LoadSceneMode arg1) (at Assets/Completed/Scripts/GameManager.cs:69)
UnityEngine.SceneManagement.SceneManager.Internal_SceneLoaded (Scene scene, LoadSceneMode mode) (at C:/buildslave/unity/build/artifacts/generated/common/runtime/SceneManagerBindings.gen.cs:230)
I'm not even using this script. It's in the "Completed" folder of the tutorial, it's just there for verification purposes, i've been going around it, the game still works but I feel this could escalate.
So is this normal? What should I do, just delete all the completed scripts?
Comment
Best Answer
Answer by Landern · Jun 26, 2017 at 09:02 PM
It is normal, unity will try and compile all the scripts/classes in your project, so even though you haven't attached it to anything it will still try and compile. You can either delete it or try and multi-line comment it out. Optionally you can fix the error.
/* Add to top of class
Multi-line comment
*/ Add to end of class