Being a relative beginner to programming, I’m having trouble using bitshifting to make the right CullingMask for my camera in code (C#). Here’s what I’ve got:
- Layer 8
- Layer 30
- Layer 31
- A camera that I want to see only these layers.
I know how to set only one layer as the CullingMask, but I can’t figure out how to set it to all three of these. Can anyone help me out?
Thanks!
public LayerMask myLayers;
Then set them in the inspector; no need for bitshifting.
–Eric
Eric,
Thanks for the help, but unfortunately I can’t take that approach in this case. I’m creating the camera through code, and the CullingMask could be different every time (based on what’s currently in the scene), so I can’t set them in the inspector. How would I create the example from the first post with bitshifting?
Thanks again-
(1 << 8) + (1 << 30) + (1 << 31)
–Eric