how to stop a camera for showing your body in multiplayer

i want to disable your own body for your own camera. and still let other people (with the same player prefab) see my player’s body.

i found NetworkView.isMine but it doesnt work.

how can i do this?

using UnityEngine;
using UnityEngine.Networking;

public class PlayerSettup : NetworkBehaviour {
    public GameObject bodyPart;
    public GameObject bodyPart1;
    void Start () {
        if (NetworkView.)
        {
            bodyPart.SetActive(true);
            bodyPart1.SetActive(true);
        }
        else
        {
            bodyPart.SetActive(false);
            bodyPart1.SetActive(false);
        }
    }
}

I haven’t done multi yet, but I’d read a lot of this tutorial (there are other sections but this is the important one):
https://unity3d.com/learn/tutorials/topics/multiplayer-networking/identifying-local-player?playlist=29690

It involved setting up a NetworkIdentity in the tutorial earlier, and you then had access to a nice, simple bool: isLocalPlayer.

Does that help?

I assume the latter part of your code is correct, so…

using UnityEngine;
using UnityEngine.Networking;

public class PlayerSettup : NetworkBehaviour {
    public GameObject bodyPart;
    public GameObject bodyPart1;
    void Start () {
        if (isLocalPlayer)
        {
            bodyPart.SetActive(true);
            bodyPart1.SetActive(true);
        }
        else
        {
            bodyPart.SetActive(false);
            bodyPart1.SetActive(false);
        }
    }
}
3 Likes

thanks alot! it is working now. again thanks

1 Like