- Home /
Check if cullingMask is being used
I have this code below, and its suppose to disable a culling mask when I leave the room, and enable a culling mask when i enter. But i dont know how to check the state of the culling mask itself. you can see in the comments below where the question needs to be asked. Really only one of the culling masks need to be checked since they are all suppose to be in the same state.
private void OnTriggerEnter(Collider other)
{
if(inner){
inPortal = true;
friendSmile.inPortal = true;
if (){//cullingmask = on
Debug.Log("going in");
cam.cullingMask = cam.cullingMask^(1<<8);
cam.cullingMask = cam.cullingMask^(1<<10);
cam.cullingMask = cam.cullingMask^(1<<12);
}
}
else{
inPortal = false;
friendSmile.inPortal = false;
if (){//cullingmask = false
Debug.Log("going out");
cam.cullingMask = cam.cullingMask^(1<<8);
cam.cullingMask = cam.cullingMask^(1<<10);
cam.cullingMask = cam.cullingMask^(1<<12);
}
}
}
Answer by AAcat · Nov 03, 2021 at 05:58 PM
my workaround was to just Debug.Log(cam.cullingMask); and find the variable at a given time. then just use if (cam.cullingMask != xxxx){ with xxxx being the number that the Debug.Log was depending on my desired outcome. Adding more cullingMasks will cause issues with this though obviously so be sure to adjust that every time you add a new culling mask.
Your answer
Follow this Question
Related Questions
culling gizmos in scene view 0 Answers
Make sure Item never culled 0 Answers
Render an layer from the position of player to a specific distance 0 Answers