GameObject.sceneCullingMask

Switch to Manual
public ulong sceneCullingMask;

Description

The Scene culling mask defined for the GameObject. (Read Only)

Unity uses SceneCullingMasks to determine which scene to render the GameObject in. The sceneCullingMask is a bitfield stored as an unsigned 64-bit integer ulong. Cameras only render an object in a scene if the bits set on the Scene's mask (retrievable withEditorSceneManager.GetSceneCullingMask) match those in the object's sceneCullingMask.

using UnityEngine;
using UnityEditor.SceneManagement;

[ExecuteInEditMode] public class ExampleClass : MonoBehaviour { void Start() { //Check if gameObject is visible in scene if(gameObject.sceneCullingMask == EditorSceneManager.GetSceneCullingMask(gameObject.scene)) { Debug.Log("Object is visible"); } else { Debug.Log("Object is not visible"); } } }

Did you find this page useful? Please give it a rating: