Skip to main content

CameraClaimer

A class in Root.Township, the global namespace.

Client debug helper for scenes without a player: keeps one camera active and lets F3 cycle through every camera with this component. Turns itself off once a PlayerController exists or on a headless build.

Constructors​

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

Fields​

4 private and internal fields
MemberWhat it is
private static readonly List<CameraClaimer> allEvery CameraClaimer that has started. Destroyed ones are removed when F3 is pressed.
private Camera checkCameraThe Camera on this object.
private static CameraClaimer currentThe claimer whose camera is active now.
private static CameraClaimer oldCurrentThe current claimer as of the last frame, so F3 is ignored the frame the current one changes.

Methods​

2 private and internal methods
MemberWhat it is
private void Start()Registers the camera and, if it's enabled, makes it the current one and disables the previous current claimer.
private void Update()Disables itself when a player controller exists or headless. Otherwise F3 switches to the next registered camera.