- Home /
2D occlusion culling - is this possible ?
How Unity deal with objects ( 2D sprites ) which are beyond the camera view ( ortographic projection ) ? Is it possible to have something like occlusion culling in 2D game ?
Answer by Dave-Carlile · Apr 08, 2016 at 08:26 PM
Occlusion culling involves not rendering objects that are covered over, or occluded, by other objects. You're looking for the term Frustum Culling which means not rendering objects that are outside of the camera's view frustum. Unity does this sort of culling automatically.
Now, if you have logic that doesn't need to run when the object isn't visible you can use the OnBecameVisible and OnBecameInvisible methods to enable and disable that logic when an object moves into/out of view of a camera.
Different from the OP, I actually need 2D occlusion culling or even partial occlusion culling based around Line of Sight detection. Are there any methods you know of that might come in handy in this case?