Skip to main content

Interface IHasUnityContext

Exposes the GameObject and Transform of a MonoBehaviour so that system code can perform spatial queries and scene-graph operations without casting the interface to a concrete type.

public interface IHasUnityContext

Remarks​

Several interfaces (IMoveable, IMoveCommandInvoker, ILookAtCommandInvoker) extend this interface because their implementations always require a Unity scene context, and surfacing it here allows callers to read transform.position or call GetComponent through the same reference without an additional cast.

Because MonoBehaviour already declares both gameObject and transform as built-in properties, any class that inherits from MonoBehaviour satisfies this interface with zero additional implementation — no explicit property bodies are needed.

Properties​

gameObject​

The game object this component is attached to. A component is always attached to a game object.

GameObject gameObject { get; }

Property Value​

GameObject

transform​

The Transform attached to this GameObject.

Transform transform { get; }

Property Value​

Transform