ControllerExtension
An abstract class in Root.Township, the global namespace.
Base for a component that adds behaviour to a player's hand controller, placed under the ghost hand or the IK hand. Runs on every copy of the player; IsLocal tells you if it's yours.
- Listed in Global namespace: C to D
- Inherits or implements
MonoBehaviour - Derived types
QuickAccessMenuController,ControllerExtensionGroup,FlyCamHands,HandGestureController,Interactor,LightHands,ModHands,Pointer,RoomRotator,ScreenShotExtension,Teleporter
Constructors
| Member | What it is |
|---|---|
protected ControllerExtension() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
4 private and internal fields
| Member | What it is |
|---|---|
private PlayerMode activeFor | Player modes (VR runtimes such as OpenVR, Oculus or OpenXR, or fly and auto cam) this extension runs in; it destroys itself otherwise. |
private Controller controller | The controller this extension is on, found in the parents. Backing field for Controller. |
private NetworkEntity entity | The player entity; set from the controller on initialize. Backing field for Entity. |
private bool isAddedToIKHand | Whether the extension goes under the IK hand instead of the ghost hand. Backing field for IsAddedToIKHand. |
Properties
| Member | What it is |
|---|---|
ControllerActionsManagerProxy Actions { get; } | The controller's action manager, for reading input actions such as interact. |
CharacterInfo CharacterInfo { get; private set; } | The character info of the controller's player, set in InitializeControllerExtension. |
Controller Controller { get; set; } | The hand controller this extends. Found in parents on first use; can only be set once. |
NetworkEntity Entity { get; } | The player's network entity, taken from the controller on init. |
PlayerInput Input { get; } | The controller's PlayerInput. |
bool IsAddedToIKHand { get; } | True if the extension belongs under the IK hand instead of the ghost hand. |
bool IsLocal { get; private set; } | True if the controller belongs to the local player. |
protected bool IsInteractFree { get; } | True if the hand can interact now: locomotion is not blocked and it is not busy with an interaction. |
Methods
| Member | What it is |
|---|---|
virtual void InitializeControllerExtension() | Copies the character info, entity and local-player flag from the controller. |
virtual void OnConnectedToPlayer(Player player) | Hook called when the extension is connected to a player. Does nothing by default. |
protected virtual void Awake() | Destroys the component if the current XR mode is not in its activeFor flags. |
Used in
Members of other types that take, return or hold a ControllerExtension: