An Occlusion Portal can either be open or closed. When an Occlusion Portal is closed, it occludes other GameObjectsThe fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary. When an Occlusion Portal is open, it does not occlude other GameObjects.
If you have a GameObject in your SceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary that has an open and a closed state (such as a door), you can create an Occlusion Portal that represents it in the occlusion cullingA process that disables rendering GameObjects that are hidden (occluded) from the view of the camera. More info
See in Glossary 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
…
}
Property: | Function: |
---|---|
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. |
OcclusionPortal