The GameObject
field in the SceneTraceResult
struct represents the GameObject
that was hit during a scene trace operation. This field is read-only and provides information about the specific game object that was intersected by the trace.
The GameObject
field in the SceneTraceResult
struct represents the GameObject
that was hit during a scene trace operation. This field is read-only and provides information about the specific game object that was intersected by the trace.
To access the GameObject
field, you must first perform a scene trace operation that returns a SceneTraceResult
. Once you have the result, you can access the GameObject
field to determine which game object was hit.
// Example of using SceneTraceResult to get the GameObject hit // Assume 'scene' is a valid Scene object and 'traceResult' is a valid PhysicsTraceResult SceneTraceResult result = SceneTraceResult.From(scene, traceResult); if (result.Hit) { GameObject hitObject = result.GameObject; // Use hitObject as needed // For example, you might want to log the name of the hit object string objectName = hitObject.Name; // Do something with objectName }