0 votes

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.

My Variables:
https://imgur.com/kew8ItY

The Code:
https://imgur.com/4Q97RJ4

The Code, but without the variable, just the node name:
https://imgur.com/lT8tUaW

The Node Structure:
https://imgur.com/G2qFbtQ

The Print Results:
https://imgur.com/HFhnu53

Godot version 3.2.3
in Engine by (103 points)

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

Hey, sorry for the late response. Didn't seem to work, still shows as a null instance.

Results:
https://imgur.com/mpPTKgs

1 Answer

0 votes

Ok, I saw it in other thread, it is really weird :)

Why print results show timers with two different IDs, aside form null objects ? You said You only printed 1 variable - attacktimer ?
Is it really whole code ? Is there nothing in autoload or parent node that can alter behavior of this sword node?

by (5,653 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.