ドキュメント

Unity Engine

Unity Engine

GetLayerMask(params string[])

Get a PhysicsMask for the specified layer name(s).
読み終わるまでの所要時間 1 分最終更新 3日前

Definition

GetLayerMask(string[])

public static PhysicsMask GetLayerMask(params string[] layerNames)

Parameters

layerNames

The layer names (case sensitive) to find a combined physics mask for.

Returns

Type

Description

PhysicsMaskThe combined physics mask for the layer names that were found. Unity produces a console warning for each layer name that isn't found and leaves it out of the mask, so if no names are found, PhysicsMask.None is returned.

Remarks

Use this method to build the category and contact masks for a PhysicsShape.ContactFilter so a shape only collides with the layers it needs to. Create the layers in a PhysicsLowLevelSettings2D asset first. When the full layers are active and more than one layer has the same name, the mask includes every layer with that name.