# Layer

Layer is an inherent attribute of scene nodes, all nodes will have their own Layer, the default is 0 (optional value is 0~29).

# Instructions

# ▌How to modify Layer

Select a node in the scene in the tool, and in the Inspector panel, click Layer to modify it.

# ▌New Layer method

Select a node in the scene in the tool, and in the Layer drop-down box in the Inspector panel, select Add at the bottom.

At present, there can be 31 layers in total, among which 30~31 are built-in layers, please do not use them. When a layer has a name, you can select the layer on the Inspector interface of the node.


# Use Layer to control rendering

Using Layer can "filter out" some objects during rendering.

# 1. Select a layer, and then set the objects in the scene to that layer

Create a new Layer as a dedicated Layer that does not render objects:

Set the Layer of the object you don't want to render to this Layer:

# 2. Modify the cullingMask of the camera

In the Inspector panel of the camera node, find the Camera component, then click on cullingMask to deselect the newly created Layer:

# 3. Play scene

It can be observed that the previously set Layer objects are not rendered.


# Use Layer to control physics collision

You can set the two layers not to collide, and you can manually set the collision matrix in the ProjectSetting tab in the tool.

For details, please refer to [Physical System](../physics/index.md#Physical Tool Function).

点击咨询小助手