Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


RenderingLayerMask

The Render Pipeline allows you to use Rendering Layers, which are LayerMasks to make Lights or effects only affect specific Renderers.
Read time 2 minutesLast updated 5 days ago

Definition

  • Type: Struct
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule
public struct RenderingLayerMask

Remarks

Rendering Layers are also supported on decal projectors, and can be sampled from the ShaderGraph to implement custom effects.
Rendering Layers are a Bitmask and it represents the 32 Layers and define them as
true
or
false
. Each bitmask describes whether the
RenderingLayer
is used. As an example, bit 5 can be set to 1 (
true
).
Edit->Settings->Tags and Layers
option shows the use of the 32 bitmasks. Each
RenderingLayer
is shown with a string setting. As an example
Layer 0
is set as
Default
. There is always at least one defined RenderingLayer.

Properties

Property

Description

valueConverts a layer mask value to an integer value.

Static Properties

Property

Description

defaultRenderingLayerMaskReturns an instance of Default Rendering Layer Mask.

Static Methods

Method

Description

GetDefinedRenderingLayerCountReturns a number of Rendering Layers defined in the Tags and Layers manager.
GetDefinedRenderingLayerNamesReturns a names of the defined Rendering Layers in the Tags and Layers manager.
GetDefinedRenderingLayersCombinedMaskValueReturns value that represents all defined Rendering Layers in the Tags and Layers manager.
GetDefinedRenderingLayerValuesReturns a values of the defined Rendering Layers in the Tags and Layers manager.
GetLastDefinedRenderingLayerIndexReturns an index of the last defined Rendering Layer in the Tags and Layers manager.
GetMaskGiven a set of rendering layer names as defined in the Tags and Layers manager, returns the equivalent rendering layer mask for all of them.
GetRenderingLayerCountReturns a number of Rendering Layers defined in the Tags and Layers manager including empty ones.
NameToRenderingLayerGiven a rendering layer name, returns the rendering layer index as defined in the Tags and Layers manager.
RenderingLayerToNameGiven a rendering layer index, returns the name of the layer as defined in the Tags and Layers manager.

Operators

Operator

Description

RenderingLayerMaskImplicitly converts
uint
to a RenderingLayerMask.
uintImplicitly converts a RenderingLayerMask to an
uint
.