Need a little help with a bit of code
Options
ive been trying to implement a team changer which allows the users to switch teams before spawning into game. now it works some what but problem is anyone who hits the button will end up switching everyone's name prefab along with the person trying to switch sides..
heres my bit of code im working with
if anyone has any ideas on how to get this working please do tell cause im running out of ideas
thanks!
heres my bit of code im working with
public void callredsideSetup()
{
pView.RPC("redsetup", PhotonTargets.AllBufferedViaServer);
}
public void callbluesideSetup()
{
pView.RPC("bluesetup", PhotonTargets.AllBufferedViaServer);
}
[PunRPC]
void bluesetup()
{
for (int i = 0; i < players.Count; i++)
{
if (players[i].transform.GetChild(0).transform.GetChild(0).GetComponent<Text>().text == PhotonNetwork.player.name)
{
if (players[i].GetComponent<PhotonView>().isMine)
{
players[i].transform.parent = BlueTeamContainer.transform;
players[i].transform.position = BlueTeamContainer.transform.position;
blueTeam = true;
}
else { return; }
}
}
}
[PunRPC]
void redsetup()
{
for (int i = 0; i < players.Count; i++)
{
if (players[i].transform.GetChild(0).transform.GetChild(0).GetComponent<Text>().text == PhotonNetwork.player.name)
{
if (players[i].GetComponent<PhotonView>().isMine)
{
players[i].transform.parent = RedTeamContainer.transform;
players[i].transform.position = RedTeamContainer.transform.position;
redTeam = true;
}
else { return; }
}
}
}
if anyone has any ideas on how to get this working please do tell cause im running out of ideas
thanks!
0
Comments
-
fixed....0