#One of my labels is not updating and I don't know why

44 messages · Page 1 of 1 (latest)

shut merlin
#

Can you set a breakpoint to line 39 in your UI script?

#

So that means this line is reached

#

You can use the little step over button top right of the debugger window to advance one line

#

It should jump inside the if block

#

It's not a crash, it pauses the execution at the breakpoint 😉

#

The one left of the pause button

#

This way you can follow thr code execution step by step

#

That means the if statement was skipped!?

#

Ok, if you run it again until the breakpoint

#

In the debugger window there should be a section where you can inspect the current values of all variables

#

Yeah you're fine! In the middle section you can scroll down until you find wave_label in the members section

#

I just realized that it says the breakpoint seems to be inside initialize_ui() but according to the code you posted line 39 should be in update_wave_label()

#

That's where I wanted the breakpoint

#

To see if that line is actually ever reached during execution

#

And the breakpoint doesn't cause the program to pause like it crashed right?

#

That means that line is never reached

#

Which means the function doesn't run

#

..which means it isn't called, or maybe called incorrectly ( which should lead to a crash )

shut merlin
#

Oh no, a breakpoint means if that particular line is reached or pauses execution

#

Ot really doesn't do anything to the code

#

You could also just use a print statement instead of breakpoints if they are to confusing

#

To see in the console if that point in the code has been reached

#

if you put a print in update_wave_label it wont trigger

#

you can try

#

and i assume also in _on_wave_entered() wont work either

#

as you would expect from what you can see ingame

#

so if _on_wave_entered() doesnt run it should mean the signal isnt properly connected to that function or not emitted in the first place

#

but i dont see anything wrong with either of those

#

well you could go upstream:

  • set a breakpoint or print where the signal is connected, see if that line actually runs
  • set one where the signal is emitted to see if that line actually runs
#

and there is no warning in the debugger window while running this right?

#

and you are testing it for multiple waves too or only the first?

#

i think the first wave starts before the signal is connected

#

that possible?

#

but your initialize_ui() call is also deferred

#

totally possible it'll run first then

#

😄

#

what you can do:

  • have a signal in the ui like ui_ready
  • emit that signal when ui is initialized
  • use await ui.ui_ready in the main _ready() function before starting the game
#

that i dont know 😄

#

yeah

#

maybe you needed it to make sure the wave manager is initialized

#

its ok to keep it this way, because at some point with a more complex project it may again make sense to defer or delay that call