Hi, I have a problem with a respawn script!
I use a var called canSpawn that in Start() function is false.
When a player is killed I use this code to wait x seconds
deadTime = respawnTimer += Time.time;
This code is placed in a RPC function.
My update function is this:
if (needRespawn)
{
if (deadTime < Time.time)
{
Debug.Log("can spawn");
canSpawn = true;
}
}
Debug.Log(“can spawn”); is printed so I fiugre that canSpawn is true.
The problem is that if I place an if statement like this: if (canSpawn) in the RPC function (the same of the deadTime = respawnTimer += Time.time; code), this if is never called.
Why?
Thanks a lot,
Marco