- Home /
Question by
captainkrisu · Oct 23, 2015 at 06:59 PM ·
unity 5networkinguser interface
UNet and player UI
How can I make each player have their own UI (Health Bar's and information).
I am using the new Unity 5 networking.
The UI is the new one (Not the OnGui).
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.Networking;
public class FighterControls : NetworkBehaviour {
public Slider healthslider;
void Update(){
//health managing
healthslider.value = currentHealth;
}
Comment
Best Answer
Answer by Jessespike · Oct 23, 2015 at 07:43 PM
Try NetworkBehaviour.isLocalPlayer
True if this object is the player object for the local client.
I already have that in the top of Update function (Sorry, forgot to add) The UI GameObjects (Canvas, EventSystem) are child objects of the player, setting is Screen Space - Camera.
For some reason the UI shows for both.
Oh, it was the camera system. But it needed the isLocalPlayer so I will accept your answer.
Your answer
![](https://koobas.hobune.stream/wayback/20220612042444im_/https://answers.unity.com/themes/thub/images/avi.jpg)