I cant seem to reference the timer, every attempt says its null
I want to make a spawner, that emits a signal every timeout and send waves left and a reference to the object created.
when the player pressed an action key it places a spawner creating a new object of spawner class
The main script will check if waves left is 0, and then call queue_free
problem is i cant seem to get the timer going other than the 1st instance, because im using the checkbox on the left to start autotimer. Subsequent placements do not start timer
If the timer is part of your spawner, ie a node in the spawner scene, you can use autostart setting to make it start the moment it enters the tree.
Then on the timeout function you can just restart the timer.
func _on_Timer_timeout():
# Restart the timer
$Timer.start()
Usually when a node reference I know should be valid, but has only just been added to the tree, is returning as null, it is usually because I have tried to access it too soon. I recently discovered call_deferred, which I use a lot now.
Perhaps starting the timer with a call_deferred might help here too.