- Home /
Question by
Albert-han · Jul 03, 2014 at 12:42 PM ·
buttonspawnnotworking
SpawnButton not working
Hi guys i created a guibutton with spawn with this script but it doesnt seem to be spawning my player.Here's my script.
void OnGUI()
{
if(MatchStarted = true)
{
if(GUI.Button(new Rect(0,0,50,20),"Spawn"))
{
MyPlayer.Manager.networkView.RPC("Spawn",RPCMode.All);
}
}
}
[RPC]
void Spawn()
{
if (networkView.isMine)
{
FirstPerson.gameObject.SetActive (true);
ThirdPerson.gameObject.SetActive (false);
}
else
{
FirstPerson.gameObject.SetActive (false);
ThirdPerson.gameObject.SetActive (true);
}
}
[RPC]
void Die()
{
FirstPerson.gameObject.SetActive (false);
ThirdPerson.gameObject.SetActive (false);
}
}
Comment
Your answer
Follow this Question
Related Questions
Escape key or button set to escape not working 1 Answer
WaitForSeconds not working in while 2 Answers
OnCollisionExit2D not getting called? 1 Answer
Mobile input is not working ... 1 Answer