Skip to main content

TimedToggle

A class in Root.Township, the global namespace.

A local component that flips a target GameObject on and off every delay seconds. No networking.

Constructors​

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

Fields​

3 private and internal fields
MemberWhat it is
private float currentTimeSeconds left until the next toggle. Starts at -1 so the first frame toggles straight away.
private float delaySeconds between toggles (minimum 0.01).
private GameObject targetThe GameObject whose active state is flipped.

Methods​

1 private and internal method
MemberWhat it is
private void Update()Counts down currentTime and toggles target each time it runs out, then restarts the countdown.