i am making a multiplayer game where the player will be spawned in a random place after they died.
i follow instruction from youtube in this link
But when i tried to play the scirpt it give me an error that says unityengine.vector3 does not have an extension Length. is it depcrecated??
[ClientRpc]
void RpcRespawn()
{
if (isLocalPlayer)
{
Vector3 spawnPoints = Vector3.zero ;
// spawn back to zero location
//transform.position = Vector3.zero;
// If there is a spawn point array and the array is not empty, pick a spawn point at random
if (spawnPoints != null && spawnPoints.Length > 0)
{
spawnpoints = spawnPoints[Random.Range(0, spawnPoints.Length)].transform.position;
}
// Set the player’s position to the chosen spawn point
transform.position = spawnpoints;
}
}