An Occlusion Portal can either be open or closed. When an Occlusion Portal is closed, it occludes other GameObjects. When an Occlusion Portal is open, it does not occlude other GameObjects.
If you have a GameObject in your Scene that has an open and a closed state (such as a door), you can create an Occlusion Portal that represents it in the occlusion culling system. You can then set the open state of the Occlusion Portal according to the state of that GameObject. An Occlusion Portal component does not need to be placed on the GameObject it represents.
Use a script to set the Occlusion Portal’s open property to the desired state.
void OpenDoor() {
// Toggle the Occlusion Portal's open state, so that Unity renders the GameObjects behind it
myOcclusionPortal.open = true;
// Call a function that plays a door opening animation, or otherwise hides the GameObject
…
}
Свойство: | Функция: |
---|---|
Open | If enabled, the Occlusion Portal is open, and does not occlude Renderers. If disabled, the Occlusion Portal is closed, and occludes Renderers. |
Center | Set the center of the Occlusion Portal. The default value is 0,0,0. |
Size | Define the size of the Occlusion Portal. |