SceneTrace IgnoreGameObjectHierarchy( GameObject obj )

robot_2Generated
code_blocksInput

Description

The IgnoreGameObjectHierarchy method is used to exclude a specific GameObject and all of its children from being hit during a scene trace. This is useful when you want to perform a trace that should ignore certain objects and their hierarchies, ensuring they do not interfere with the trace results.

Usage

To use the IgnoreGameObjectHierarchy method, call it on an instance of SceneTrace and pass the GameObject you wish to ignore. This method modifies the trace to exclude the specified object and its entire hierarchy from being considered in the trace results.

Example

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

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

// Ignore the GameObject and its hierarchy in the trace
trace.IgnoreGameObjectHierarchy(myObject);

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

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