C# programming for Unity: NullReferenceException: Object reference not set to an instance of an object

26 Views Asked by At

"NullReferenceException: Object reference not set to an instance of an object"

Hello everyone - I'm following along with a tutorial I found online for Unity with C# to build a 3D platformer from the ground up. Along the way of the tutorial (I will link it here: https://www.youtube.com/watch?v=--_CH5DYz0M or search "3D Platformer in Unity - Player Controller (Part 1)" by git-amend on YouTube), he starts talking about implementing an "InputReader" class (around 7:30). Everything was going fine in terms of implementation, but I started to get the error listed above in reference to the highlighted line:picture of code

I tried fixing it following some advice in terms of GameObject.FindWithTag("Player"), even though I saw that it wasn't really a good fix, yet the problem still remains. Is there something I'm doing wrong in terms of referencing what I assume is the Player object? The ScriptableObject is currently attached to my Player object as was done in the tutorial, but he experiences no problems with getting the game running. Any help or advice would be wonderful.

0

There are 0 best solutions below