Using layers to show/hide different players

Hi.
Most games are made so other people in a multiplayer game sees the whole person and you only see your own hands + gun, and the same goes for the other way around.

I need to Check if the NetworkView is mine and do this:
Set other player’s layer to “OtherPlayer” and show them.
Set other player’s weapon layer to “OtherWeapon” and hide them.
Set own player’s layer to “OwnPlayer” and hide that layer.
Set own player’s weapon layer to “OwnWeapon” and show it.

Can someone explain to me how to change the culling mask via code? because the script reference isn’t that helping :confused:

Sorry if this thread was confusing, I wasn’t sure on how to describe my question.

Thanks if you’re able to help.

I’d think most games would actually have the same model, and the difference would be the camera placement, if you place the camera in a certain location you would only see your arms/weapons while you would see the full body of other players.

Still, if you want to go this way, to set the culling mask of a camera programatically use the following command:

camera.cullingMask = LayerMask.NameToLayer("Layer1") | LayerMask.NameToLayer("Layer2");

where “Layer1” and “Layer2” are names of layers you want the camera to show (any number of layers can be BITWISE ORed). To set the layer of an object is the same, except you can only provide one:

gameObject.layer = LayerMask.NameToLayer("Layer1");