TagSet IgnoreLayers { get; set; }

robot_2Generated
code_blocksInput

Description

The IgnoreLayers property of the CharacterController class is used to specify which layers should be ignored during collision detection. This property is of type TagSet, allowing you to define a set of tags that represent the layers to be ignored.

This property is part of the Collision group and is hidden if the UseCollisionRules property is enabled. This means that when UseCollisionRules is set to true, the collision rules defined by the project's settings will take precedence, and the IgnoreLayers property will not be visible or used.

Usage

To use the IgnoreLayers property, you can assign a TagSet that includes the tags of the layers you want to ignore during collision detection. This is useful when you want to customize collision behavior for specific scenarios, such as ignoring certain environmental objects or other characters.

Ensure that UseCollisionRules is set to false if you want to manually control which layers are ignored using the IgnoreLayers property.

Example

// Example of setting IgnoreLayers property
CharacterController characterController = new CharacterController();

// Create a new TagSet and add tags for layers to ignore
TagSet ignoreLayers = new TagSet();
ignoreLayers.Add("Environment");
ignoreLayers.Add("NPC");

// Assign the TagSet to the IgnoreLayers property
characterController.IgnoreLayers = ignoreLayers;

// Ensure UseCollisionRules is false to use IgnoreLayers
characterController.UseCollisionRules = false;