Skip to main content

InGameInspector

A class in Root.Township, the global namespace.

A debug tool item with 12 modes (LOD tools, chunk bounds, teleporters, console command runner, cloner, bubble inspector). Only players with the debug_features permission can hold it; others are forced to drop it.

Constructors​

MemberWhat it is
InGameInspector()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

18 private and internal fields
MemberWhat it is
private InGameInspector.InGameTool[] availableToolsThe debug tools: LOD tools, chunk bounds, teleporters, mine stairs pointer, command runner, cloner and bubble inspector.
private Image bgBackground image behind the label.
private Material chunkBoundsMaterialMaterial used by the chunk bounds tool.
private PlayerInput controllerPlayer input of whoever is holding the inspector.
private int currentToolBacking field for CurrentTool, the index into availableTools.
private AltaCoroutine displayingMessageThe running DisplayMessage coroutine, if any.
private bool isDoubleClickingNot used in this build.
private bool isRaycastingWhether the pointer ray is on. Tools only pick targets while it is.
private bool isRotatingTrue while a swipe rotation is being tracked.
private Color[] lodColorsColours, one per LOD level, used by the LOD visualiser.
private Material lodMaterialBase material the LOD visualiser tints with lodColors.
private LODChange logSerialized LODChange reference. Not read by the inspector's own code.
private float messageDurationHow long a timed message stays up, in seconds (2 by default).
private Image minesCompassArrow image the mine stairs pointer turns toward the nearest stairs.
private Text objectNameText label that shows tool names and results.
private Transform pointerTransformWhere the pointer ray starts and which way it points.
private Vector2 previousValueSwipe position when rotation tracking started.
private MethodSyncStruct<int> syncMessageMethod sync made in Initialize and sent by SendMessage to share the current tool's data.

Properties​

MemberWhat it is
int CountTools { get; private set; }Number of tools (12).
int CurrentTool { get; set; }Index of the active tool. Setting it disables the old tool, enables the new one if held, and shows its name.
4 private and internal properties
MemberWhat it is
private string DisplayText { get; set; }Text on the inspector's label. Setting it shows the label, unless a timed message is showing.
private Pickup Pickup { get; set; }The pickup this inspector is on, found in Awake.
private Vector3 Pointing { get; set; }Direction the mines compass arrow points. Setting it turns the arrow toward that direction and shows it.
private LineRenderer Renderer { get; set; }Line renderer that draws the pointer ray while raycasting is on.

Methods​

MemberWhat it is
void ChangeToolDown()Switches to the previous tool, wrapping round. Only for the local player holding it.
void ChangeToolUp()Switches to the next tool, wrapping round. Only for the local player holding it.
override void Initialize()Sets up the network message that syncs the active tool's data.
void PressClear()Sends the clear press to the active tool. Only for the local player holding it.
void PressDown()Sends the down press to the active tool. Only for the local player holding it.
void PressUp()Sends the up press to the active tool. Only for the local player holding it.
void SendMessage()Sends the active tool's data to everyone in the item's chunks.
void ToggleRaycasting(bool isEnabled)Shows or hides the pointer line.
10 private and internal methods
MemberWhat it is
private void Awake()Hooks the pickup's interaction events, gets the line renderer and builds the 12 debug tools.
private void CheckInput(PlayerInput playerInput)On the local player's teleport press, starts tracking swipe rotation and passes the input to the current tool.
private IEnumerator DisplayMessage(string message) (iterator)Coroutine that shows a message (such as the tool name) for messageDuration seconds, then hides it.
private void Interact(Interactable pickup, Interactor interactor)On grab, drops the item if the local player lacks the debug_features permission, else enables the current tool.
private void OnDestroy()Disables the current tool.
private void Start()Empty.
private void Stop(Interactable arg1, Interactor arg2)On release, unhooks the teleport input, disables the current tool and hides the label and compass.
private void SyncMessage(IPlayer player, Stream stream, int arguments)Method sync that sends the tool index, then lets that tool serialize its own data.
private void ToggleEnable(bool isEnabled)When disabling, hides the label, background and mines compass.
private void Update()While held, turns swipe motion into an angle for the tool, draws the pointer ray and updates the current tool.

Used in​

Members of other types that take, return or hold a InGameInspector: