ドキュメント

Unity Engine

Unity Engine

sceneCullingMask

The Scene culling mask defined for the GameObject. (Read Only)
読み終わるまでの所要時間 1 分最終更新 1ヶ月前

Definition

  • Type: Property
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule
public ulong sceneCullingMask { get; }

Remarks

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"); } } }