NullReferenceException after save the Scene and Project
ENGLISH
Hello everyone, I have a problem after completing the tutorial Six on "Player Health" on Survival Shooter Tutorial.
First of all, i'm using git for the project and it helps me so much. In the project all is good before completing the tutorial n°6, i mean the enemy follows the player and i watch his HUD for the life.
When i put the scripts "PlayerHealth.cs" to player and "EnemyAttack.cs" to zombunny all it's fine, the enemy can attack the player and this dies. Good!, here is no problem.
Here it's the problem: When I save the Scene and the project. Then i close Unity and everything about it like Visual Studio (if it's open), then I open Unity and then i press Play/Run Button in the project and finally the Error: This time the enemy isn't following and/or attacking the player, it moves to a place in the environment.
Unity error: NullReferenceException: Object reference not set to an instance of an object EnemyAttack.Update () (at Assets/Scripts/Enemy/EnemyAttack.cs:54)
first I thought: Maybe is something about git but i was wrong. Is something in Unity but i don't know what it is.
I'm worried because i don't want to have this problem in other project or personal projects. I hope you have a solution. Many thanks.
Esvan.
Information about my PC.
SO: Windows 8.1 Pro 64 bits.
Unity: 5.4.1f1 personal.
SPANISH
Hola a todos, tengo un problema luego de completar el tutorial 6 en “Player Health” en el tutorial del Survival Shooter Tutorial.
Primero que todo, estoy usando git para el proyecto y me ayuda mucho. En el proyecto todo esta bien antes de completar el tutorial n°6, quiero decir que el enemigo sigue al jugador y puedo ver el HUD para la vida.
Cuando pongo el script “PlayerHealth.cs” al jugador y “EnemyAttack.cs” al zombunny todo esta bien, el enemigo puede atacar al jugador y este muere. Bien!, aquí no hay problema.
Aquí esta el problema: Cuando grabo el Scene y el Project. Luego cierro Unity y todo acerca de ello como Visual Studio (si estuviera abierto), luego abro Unity y presiono el botón Play/Run en el proyecto y finalmente el Error: Esta vez el enemigo no sigue y/o ataca al jugador, este se mueve a un lugar en el entorno.
Error Unity: NullReferenceException: Object reference not set to an instance of an object EnemyAttack.Update () (at Assets/Scripts/Enemy/EnemyAttack.cs:54)
Primero pensé: Seguramente es algo acerca de git pero estaba equivocado. Es algo en Unity pero no se que puede ser.
Estoy preocupado porque no quiero tener este problema en otro proyecto o proyectos personales. Espero tengan una solución. Muchas Gracias.
Esvan
información de mi PC.
SO: Windows 8.1 Pro 64 bits.
Unity: 5.4.1f1 personal.