r/Unity3D•
thewolf20

Questions about the "Survival Shooter" tutorial

Question

Hello,

I'm learning Unity 3D with the official Unity tutorials. Right now I'm at part 7 of the "Survival Shooter" tutorial:

https://www.youtube.com/watch?v=l86gpYbQFzY

But I have some questions:

At the end of the tutorial, we had to check if the player or enemy is still alive in the EnemyMovements script, because we got an error ("SetDestination" can only be called on an active agent that has been placed on a NavMesh). But that error doesn't make any sense to me: If the enemy is dead, we call Destroy(gameObject) in the EnemyHealth script, which should destroy the entire GameObject with it's component. It doesn't make sense to me, that the Enemy Gameobject got destroyed (including it's NavMeshAgent component) but the EnemyMovement script still exist (which was also a Component of said GameObjetc) and can call nav.SetDestination(). Shouldn't be the scripts also destroyed and thus unable to execute further (and thus being unable to call the nav.SetDestination() function) ? I hope you get what I mean.

The second question is: Why do they call playerShooting.DisableEffects() in the PlayerHealth script in the Death() function? It doesn't work at all (that's why we have to set playerShooting.enabled = false later in the death() function).

Posted May 8, 2017, 8:30 PM UTC

10

No comments yet

Nobody commented on this post, or the comments weren't captured.