SwitchTimer: A Node to Auto-Reset Switch After a Delay

Hi everyone! I’m sharing a simple but handy node and script I created using GDScript to automatically turn off a switch (boolean) after a set duration.

By placing this as a child of any GameObject, it detects when a specific property is set to true and flips it back to false after a designated number of seconds.

Demo:

Why I made this: While you can achieve the same result by creating child objects with VisualScript, I wanted a single-node solution to keep the scene tree clean. It’s particularly useful for managing manual invincibility frames or handling switches for transitions from AnyState in AnimationTrees.

Downloads:

How to use:

  1. Import switch_timer.gd and switch_timer.tscn into your FileSystem.
  2. Add switch_timer.tscn as a child of the GameObject you want to monitor.
  3. Specify the target variable name and the delay time in the inspector, and you’re good to go!
5 Likes

This is a very convenient plugin, thank you for sharing!

1 Like