Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | OiKeTTLe |
So I’ve been having some trouble starting a timer, due to it being a null instance for some reason. I have no idea what’s wrong. I’ve tried attaching it to a variable and printing said variable every idle frame; sometimes it shows the timer, other times it says that it’s null. Everything looks right in the code, so I don’t know what the issue is. Any help would be appreciated.
The Code, but without the variable, just the node name:
Try something simple: on a button press (cancel, enter, whatever), start the timer, on another button press, print the timer, nothing else.
I see you’ve set up attacktimer and swingtimer, so experiment making both start() on that above situation, then print. Something like this on the print should help you out:
if Input.is_action_just_pressed("ui_cancel"):
print(attacktimer.is_stopped, " - ", attacktimer.time_left)
attacktimer.start() #forces a restart after printing the previous result
MisterMano | 2021-10-30 02:27
Hey, sorry for the late response. Didn’t seem to work, still shows as a null instance.
Results:
Imgur: The magic of the Internet
OiKeTTLe | 2021-10-31 00:56