SceneTrace IgnoreGameObjectHierarchy( GameObject obj )

book_4_sparkGenerated
code_blocksInput

Description

The IgnoreGameObjectHierarchy method is used to exclude a specific GameObject and all of its children from being hit by a trace operation. This is particularly useful when you want to perform a trace in a scene but need to ignore certain objects and their hierarchies to avoid unwanted collisions or interactions.

Usage

To use the IgnoreGameObjectHierarchy method, you need to have an instance of SceneTrace. Call this method on the instance, passing the GameObject you wish to ignore. This will configure the trace to skip the specified object and its entire hierarchy during the trace operation.

Example

// Create a SceneTrace instance
SceneTrace trace = new SceneTrace();

// Get the GameObject you want to ignore
GameObject myObject = ...; // Assume this is initialized

// Configure the trace to ignore the GameObject and its hierarchy
trace.IgnoreGameObjectHierarchy(myObject);

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

// Process the result
if (result.Hit)
{
    // Handle the hit
}