- Home /
Networking how to correctly respawn players
I have players, when I join the server they can all see each other fine, once the player dies I call a Network.Destroy, in the scene editor it looks like it deletes the players fine, then I respawn the players using Network.instantiate. Old players still see the dead player in the place where he was deleted, and don't see the new one.
Answer by EliasMc · Feb 18, 2016 at 08:47 AM
Maybe not the most efficient way... But, I added a bit of code to the start method that goes something like:
void Start(){
GameObject[] players = GameObject.FindObjectsWithTag("Player");
foreach (GameObject _player in players){
if(_player.GetComponent<script with isDead variable>().isDead){
_player.GetComponent<Renderer>().enabled = false;
... and what ever else you do to get your players to appear dead
}
}
}
Just something like that. Hope this helps. If there are any better solutions let me know.
Your answer
Follow this Question
Related Questions
RPC call ending up on wrong target 1 Answer
Help|sync movement in multiplayer 1 Answer
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
RPC setName() not working correctly 0 Answers
Set unity process as server and client? 0 Answers