Hello,
I’ve a bug I can’t solve myself because I’m too new to Unity.
I’m stuck on the Survival Shooter tutorial, on the 7th page (Survival Shooter Training Day Phases - Unity Learn).
When I play the game, the Zombunny keeps walking on the same place and the Player can’t be damaged even when I make him contact the Zombunny.
Here are the 2 errors I get in the console (probably the problem is the same ?):
NullReferenceException: Object reference not set to an instance of an object
EnemyMovement.Update () (at Assets/Scripts/Enemy/EnemyMovement.cs:30)
NullReferenceException: Object reference not set to an instance of an object
EnemyAttack.Update () (at Assets/Scripts/Enemy/EnemyAttack.cs:63)
I’ve copied the code of the script on each page of the tutorial. I’ve just added extra comments to better understand and remember Unity scripting.
Interesting fact, I’ve tried these 2 commands just before 30th line in the script EnemyMovement.cs and they returned different results, which sounds suspicious :
Debug.Log(enemyHealth == null); returns False
Debug.Log(playerHealth == null); returns True
So I think the problem is with playerHealth variable, but I don’t know what I’ve to do.
Please, I need help !
Julien