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, call it on an instance of SceneTrace
and pass an array of strings representing the tags you are interested in. The method will return a new SceneTrace
instance configured to only include entities with any of the specified tags in the trace results.
Example
// Example usage of WithAnyTags
SceneTrace trace = new SceneTrace();
trace = trace.WithAnyTags(new string[] { "enemy", "player", "npc" });
// 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
}