Created
April 16, 2025 14:56
-
-
Save WolfgangSenff/95ef44e4b6052f3071374c3398ee870c to your computer and use it in GitHub Desktop.
Variable checker for Godot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This useful little class can be created in a node and it'll make it so you can, on a timer, check the value of a specific variable by simply passing in the variable name | |
class_name VariableChecker | |
extends Timer | |
func _init(check_time: float, variable_name: String, check_against: Node) -> void: | |
wait_time = check_time | |
autostart = true | |
timeout.connect(func(): print(check_against[variable_name])) | |
check_against.add_child(self) | |
# Usage | |
var var_checker | |
func _ready() -> void: | |
var_checker = VariableChecker.new(2.0, "velocity", self) # Every 2 seconds it prints the current velocity of this CharacterBody |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment