Quantcast
Channel: Answers for "Conflict between Pathfinding & Respawning"
Viewing all articles
Browse latest Browse all 4

Answer by chariot

$
0
0
If u have only one player u can try to find with tag in Update or make some conditions for finding it. For ex in pathfinding script. Also u need to send "dead" bool to this script before destroing player, and then bump find new object. private var playerObj : GameObject; private var bump : boolean; function Start (){ playerObj = GameObject.FindGameObjectWithTag("Player"); } function Update(){ var playerScr : NameOfPlayerScript = playerObj.GetComponent(NameOfPlayerScript); if (playerScr.dead){ bump = true; } else { bump = false; } if (bump){ playerObj = GameObject.FindGameObjectWithTag("Player"); } } More simple (but expensive) way in Update () drop this: playerObj = GameObject.FindGameObjectWithTag("Player"); And dont forget to set tag for player :)

Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images