Hey there,
i got a problem with respawn. I'm developing a game for vr so you'll understand that it's not recommend to use the common way.
Every player has got a localplayer which is already in scene and does not get instantiated. When a player joins a room he gets two hands and a head. On the head there is a value for healtpoints.
When the healthpoints are <= 0 the LOCAL player should go to a specific position.
Here's the code:
void PlayerDeath()
{
if (curPlayerHealth <= 0)
{
GameObject localPlayer = GameObject.FindGameObjectWithTag("Player");
localPlayer.transform.position = new Vector3(0, 15, 0);
}
}
So this code is on the networked head. If MYhealthpoints fall down to 0 i get teleported to the position but if i kill another player nothing happens.
How can i solve this problem?
i got a problem with respawn. I'm developing a game for vr so you'll understand that it's not recommend to use the common way.
Every player has got a localplayer which is already in scene and does not get instantiated. When a player joins a room he gets two hands and a head. On the head there is a value for healtpoints.
When the healthpoints are <= 0 the LOCAL player should go to a specific position.
Here's the code:
void PlayerDeath()
{
if (curPlayerHealth <= 0)
{
GameObject localPlayer = GameObject.FindGameObjectWithTag("Player");
localPlayer.transform.position = new Vector3(0, 15, 0);
}
}
So this code is on the networked head. If MYhealthpoints fall down to 0 i get teleported to the position but if i kill another player nothing happens.
How can i solve this problem?