Passing down Nodes/Node References in Code

Godot 4.3 .Net

I’m currently toying around with Godot for a bit, I am a software dev by day (c++) and I am having some trouble adjusting my thought process to Godot/C#.

Currently I am trying to have my UI Update once I instantiate the Scene “DJsHundeFriedhof”, it’s supposed to be a builing and for now it’s supposed to update my UI once every second in order to “increase” my ressources.

My “RessourceMenu” consits of a Controll node wich contains 2 Labels.
It’s part of my “GameCore” scene.
I have “RessourceMenu” Variable in my “BuildMenu” class and once I create a Building, it get’s passed down to the Building.
Builiding then is Supposed to Update the first Label of “RessourceMenu” every time a timer runs out. BUT I have 2 Overlapping Labels now? I am pretty sure my whole “RessourceMenu” is getting copied and drawn a second time.

It could be, hard to know what is happening without seeing the actual code. However, you should be able to confirm if you are getting duplicate labels by testing the game from the editor. Once launched go back to editor screen, and switch the scene view from local to remote. This should allow you to see your nodes that are actually loaded into the game, to see if you have a duplicated label.

1 Like

First off, thanks for your reply :D.
And Secondly, Thanks for the tip with the Editor! I didn’t even know that one yet and it makes so many things so much easier.

Well I solved my problem in the end I forgot that I set the Node that Handles my UI as Global Variable in Godot without really realising it.
so I actually HAD a second instance of that whole shannanigans running.

Ahhh! Yeah that would do it hahaha!

1 Like