Description
The WithAnyTags
method of the SceneTrace
struct allows you to filter entities in a scene trace operation based on a set of tags. This method will configure the trace to only return entities that have at least one of the specified tags. This is useful when you want to perform operations on entities that belong to any of several categories or groups, as defined by their tags.
Usage
To use the WithAnyTags
method, you need to have an instance of SceneTrace
. You can then call this method with an array of strings representing the tags you are interested in. The method will return a new SceneTrace
instance configured to filter entities by the specified tags.
Example
// Example usage of WithAnyTags method
SceneTrace trace = new SceneTrace();
trace = trace.WithAnyTags(new string[] { "enemy", "npc", "interactive" });
// Run the trace
SceneTraceResult result = trace.Run();
// Check if the trace hit any entity with the specified tags
if (result.Hit)
{
// Handle the hit entity
GameObject hitObject = result.Entity;
// Perform operations on the hit object
}