InteractableInspector
A class in Root.Township, the global namespace.
Debug bubble shown in the world for inspecting a prefab's components, methods and values in game. Pooled, client side, and released when you move more than 5 m away.
- Listed in Global namespace: I to L
- Inherits or implements
PooledObject - Attributes
RequireComponent
Constructors
| Member | What it is |
|---|---|
InteractableInspector() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
16 private and internal fields
| Member | What it is |
|---|---|
private AnimationCurve angleToVariation | Curve that maps hand twist angle to how far the value is rotated. |
private bool btnInteract | Inspector button that calls Interact from the editor. |
private Renderer bubbleRenderer | Renderer of the bubble, coloured by inspector type. |
private bool canRotate | Copied from the inspector: whether twisting the hand rotates the value. |
private Coroutine checkingCoroutine | The running CheckInteraction, or null. |
private Material componentMaterial | Bubble material for component inspectors. |
private static Dictionary<Interactor, InteractableInspector> currentList | Static map of which bubble each interactor is currently using, so one hand drives one bubble at a time. |
private InspectorBase inspector | The InspectorBase this bubble shows, set by RegisterInspector. |
private Interactable interactable | The Interactable on this object. |
private Material interactorMaterial | Bubble material for interactor inspectors. |
private Material methodMaterial | Bubble material for method inspectors. |
private NetworkPrefab prefab | The inspected prefab, whose destruction cleans up the bubble. |
private Component root | The component being inspected. |
private Transform rootTransform | Transform of root, used for the distance check. |
private TextPopup text | The pooled text popup that shows the name. |
private Material valueMaterial | Bubble material for value inspectors. |
Methods
| Member | What it is |
|---|---|
void Clean() | Unhooks everything, releases its text and returns the bubble to the pool. |
void RegisterInspector(InspectorBase inspector, Component root) | Sets which component, method, value or interactor this bubble shows and colours it by type. |
void RegisterPrefab(NetworkPrefab prefab) | Cleans the bubble up when that prefab's entity is destroyed. |
8 private and internal methods
| Member | What it is |
|---|---|
private void Awake() | Caches the Interactable and bubble renderer, hooks the interaction filter and the pool's Requested event. |
private IEnumerator CheckInteraction(Interactor interactor) (iterator) | Coroutine while Interact is held: dragging moves the bubble (inspector.Move), twisting rotates (inspector.Rotate), holding still and releasing calls Interact. |
private void DistanceRelease(PlayerController player, Vector3 oldPosition, Vector3 newPosition, LocomotionFunction function) | Client: releases the bubble and its label once the local player is more than 5 m from the inspected object. |
private void FilterInteraction(Interactor interactor, Interactable interactable, ref bool result) | Interaction filter that blocks the normal interaction and starts CheckInteraction instead, one per interactor. |
private void Interact() | Runs the inspector's action on the inspected component. |
private void OnRequested(PooledObject pooledObject) | Pool callback: spawns the text label and starts watching the local player's distance. Releases itself if there's no local player. |
private void TargetDestroyed(NetworkEntity entity, bool isUnload) | Calls Clean when the inspected prefab's entity is destroyed. |
private void UpdateName(string addition = "") | Sets the label text to the inspector's name plus an optional suffix. |
Used in
Members of other types that take, return or hold a InteractableInspector: