Skip to main content

ToggleCameraDepth

A class in Root.Township, the global namespace.

A debug component on a camera that swaps its depth and render texture to alternate values when a key is pressed. The last one to wake is Instance.

Constructors​

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

Fields​

7 private and internal fields
MemberWhat it is
private float alternateDepthCamera depth used while toggled.
private RenderTexture alternateTextureRender texture used while toggled.
private Camera cameraToToggleThe camera on this object.
private float initialDepthCamera depth at Awake, restored when toggled back.
private RenderTexture initialTextureTarget texture at Awake, restored when toggled back.
private bool isToggledWhether the alternate settings are in use.
private KeyCode toggleKeyKeyboard key that calls Toggle.

Properties​

MemberWhat it is
static ToggleCameraDepth Instance { get; private set; }The most recently woken ToggleCameraDepth.

Methods​

MemberWhat it is
void Toggle()Swaps the camera between its starting depth and texture and the alternate ones.
2 private and internal methods
MemberWhat it is
private void Awake()Sets Instance and records the camera's starting depth and target texture.
private void Update()Calls Toggle when toggleKey is pressed.