GameObject Target { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The Target property of the ManualHitbox class specifies the GameObject that will be reported in trace hits. If this property is not explicitly set, the default behavior is to use the GameObject on which the ManualHitbox component is attached.

Usage

To use the Target property, you can assign a GameObject to it. This is useful when you want the hitbox to report hits on a different object than the one it is attached to.

Example

// Example of setting the Target property
ManualHitbox hitbox = new ManualHitbox();
GameObject targetObject = new GameObject();
hitbox.Target = targetObject;

// If Target is not set, it defaults to the GameObject the component is attached to
GameObject defaultTarget = hitbox.Target; // This will be the GameObject the hitbox is attached to if not set