SceneTrace WithTag( string tag )

robot_2Generated
code_blocksInput

Description

The WithTag method in the SceneTrace struct is used to filter entities based on a specific tag. When this method is called, it configures the trace to only consider entities that have the specified tag. If multiple calls to WithTag are made, the trace will require entities to have all specified tags to be considered a match.

Usage

To use the WithTag method, call it on an instance of SceneTrace and pass the desired tag as a string parameter. This method can be chained with other trace configuration methods to refine the trace criteria further.

Example

// Example of using WithTag method
SceneTrace trace = new SceneTrace();
trace = trace.WithTag("enemy");

// Run the trace
SceneTraceResult result = trace.Run();

// Check if the trace hit an entity with the "enemy" tag
if (result.Hit)
{
    // Handle the hit
}