Description
The WithAnyTags
method of the SceneTrace
struct allows you to filter the trace results to only include entities that have any of the specified tags. This is useful when you want to perform a trace operation but are only interested in entities that match at least one of a set of tags.
Usage
To use the WithAnyTags
method, you need to pass an array of strings representing the tags you are interested in. The method will return a SceneTrace
object that can be further configured or executed to perform the trace.
Example
// Example usage of WithAnyTags
SceneTrace trace = new SceneTrace();
trace = trace.WithAnyTags(new string[] { "enemy", "obstacle" });
// Run the trace
SceneTraceResult result = trace.Run();
// Check if the trace hit any entity with the specified tags
if (result.Hit)
{
// Handle the hit
GameObject hitObject = result.Entity;
// Do something with the hit object
}