Quantcast
Channel: Questions in topic: "exception"
Viewing all articles
Browse latest Browse all 470

Help me to debug this error please :"NullReferenceException: Object reference not set to an instance of an object EnemyMovement.Update () (at Assets/Scripts/Enemy/EnemyMovement.cs:30)"

$
0
0
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 (http://unity3d.com/learn/tutorials/projects/survival-shooter/harming-enemies?playlist=17144). 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 ! ![alt text][1] Julien [1]: /storage/temp/62035-enemymovementbug01.jpg

Viewing all articles
Browse latest Browse all 470

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>