- Home /
Question by
AtlasTheTitan · Mar 06, 2018 at 04:25 PM ·
networkinguser interface
problems with multiplayer UI setup,Problems with full UI mobile game
i have some problems with my multiplayer mobile party game. it's all UI based and the problem is that each player has their own interface, but they all use the same camera. how can i change this? i don't know wich piece of code i should give so i'll just include my SetupLocalPlayer script:
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.Networking; public class SetupLocalPlayer : NetworkBehaviour {
[SyncVar]
public string pname = "player";
private Text topname;
private bool tag = true;
[SyncVar]
public Color playerColor = Color.white;
void Start () {
if (isLocalPlayer){
GetComponent<SpriteRenderer>().color = playerColor;
}
this.transform.position = new Vector2(Random.Range(-20,20),Random.Range(-20,20));
}
void Update () {
if(tag == false){
if(topname == null){
topname = GameObject.FindWithTag("TopName").GetComponent<Text>();
} else {
topname.text = pname;
tag = true;
}
}
}
public override void OnStartLocalPlayer()
{
tag = false;
}
}
Comment
Your answer
Follow this Question
Related Questions
Unity networking tutorial? 6 Answers
UNet and player UI 1 Answer
A connection has already been set as ready. There can only be one. 0 Answers
Changing UI for network chat 1 Answer
Login screen with HTTP GET request 2 Answers