Legacy Documentation: Version 4.5.0

Script language:

  • JS
  • C#
  • Boo
Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

var cullingMask: int;
int cullingMask;
cullingMask as int

Description

This is used to light certain objects in the scene selectively.

A GameObject will only be illuminated by a light if that light's cullingMask/ includes the layer chosen for the GameObject (ie, the mask bit for the layer must be set to 1 for the object to receive any light). See Layers for more information about layer masking. See Also: Light component.

	// Only light objects in the first layer (Default layer)
	light.cullingMask = 1 << 0;
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    void Example() {
        light.cullingMask = 1 << 0;
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	def Example() as void:
		light.cullingMask = (1 << 0)