Hello All!
This is my first post, so hopefully I’m doing it right. While I was in the process of Managed my next states(Lesson 26), I noticed I kept getting the error message:
“NullReferenceException: Object reference not set to an instance of an object
AdventureGame.Start () (at Assets/Scripts/AdventureGame.cs:19)”
And
“NullReferenceException: Object reference not set to an instance of an object
AdventureGame.ManageState () (at Assets/Scripts/AdventureGame.cs:30)”
Line 19 is textComponent.text = state.GetStateStory();
Line 30 is var nextStates = state.GetNextStates();
I didn’t see anything wrong with my code, as it was exactly the same as the one posted on the sections github.
I replaced my State.cs and AdventureGame.cs with the one’s of the github as well just to test, and I’m still getting the same issue, so I’m assuming it has to be something in Unity.
Also, when I run the Attach to Unity and Play option in Visual Studios 2017, it’s saying that everything related to state is NULL. But again, the game works, so I’m not sure why it’s shows as NULL here. I’m wondering if there was something else I had to do with the State.cs to make sure everything is defined first?
I’m using Unity 2018.1.1f1 if that helps.
Thanks so much!