For example, when a player attack another player who is far from him isn’t suppose to see it, how can I disable it for other players.
Thanks
For example, when a player attack another player who is far from him isn’t suppose to see it, how can I disable it for other players.
Thanks
public class basicAttack : NetworkBehaviour
{
public GameObject yourself;
// Use this for initialization
void Start ()
{
if (yourself != isLocalPlayer&& yourself.GetComponent<LightController>().visibility != true)
gameObject.SetActive(false);
}
So I wrote some code for a prefab, but it only work for client. So clents have to get close to other players to show their prefabs but everyone can see the server’s prefab no matter where they are.
Can anyone help me?