I want to hide my player’s body and add arms with gun,but,when i hide my player’s layer in culling mask i didn’t see the others player’s bodies…That’s the script i tried…but it isn’t working,camera don’t hide my body even if layer has been set,idk why.There’s the script :
using UnityEngine;
using System.Collections;
public class CameraCullingMask : MonoBehaviour {
void Start()
{
if(GetComponent<PhotonView>().isMine)
{
this.gameObject.transform.FindChild("SoldierLocomotion").gameObject.layer = LayerMask.NameToLayer("Soldier");
this.gameObject.transform.FindChild("Main Camera").camera.cullingMask = ~(1 << 9); //Layer 9 is my Soldier
}
else
{
if(GetComponent<PhotonView>().instantiationId >= 0)
{
gameObject.transform.FindChild("SoldierLocomotion").gameObject.layer = LayerMask.NameToLayer("Soldier1");
Camera.main.cullingMask = ~(1 << 10);//Layer 10 is another player's Soldier
}
}
}
}