differentiate cloning objects with different tag names on PUNRPC
Options
I try to change the tag names of instantiate game object on PUNRPC but it doesn't effect , tags names are not changing. This is the code i have used:-
IEnumerator SpawnPlayer(float respawnTime)
{
yield return new WaitForSeconds(respawnTime);
int index = Random.Range (0, spawnPoints.Length);
player = PhotonNetwork.Instantiate ("A03", spawnPoints [index].position, spawnPoints [index].rotation, 0);
photonView.RPC ("PlayerTag", PhotonTargets.All, player);
[PunRPC]
void PlayerTag(GameObject player)
{
if (playerCount == 1) {
player.tag = "One";
}
if (playerCount == 2) {
player.tag = "Two";
}
}
Please send me the solution.
IEnumerator SpawnPlayer(float respawnTime)
{
yield return new WaitForSeconds(respawnTime);
int index = Random.Range (0, spawnPoints.Length);
player = PhotonNetwork.Instantiate ("A03", spawnPoints [index].position, spawnPoints [index].rotation, 0);
photonView.RPC ("PlayerTag", PhotonTargets.All, player);
[PunRPC]
void PlayerTag(GameObject player)
{
if (playerCount == 1) {
player.tag = "One";
}
if (playerCount == 2) {
player.tag = "Two";
}
}
Please send me the solution.
0