I have a counter that displays the nuber of money but another counter appears too

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Giannis1996

Hello everybody, i have made a counter that displays the money but i notices another counter that appears at the top left of my screen
The label script

extends Label

func _process(_delta):
	text = String(Global.coins)

the coins is a global variable and i have made a script for it

script for the global variable coins

extends Node

var coins = 0

when i play the game another label is created in the spatial
i haven’t got a code that creates another node in the spatial

so, what could go wrong with it?
I am sure the problem comes with that self created label but i don’t know from where it’s made

Mabey you have code somewhere else making the number?

Merlin1846 | 2020-03-19 23:36

Mind sharing your scene tree?

dorijan5484 | 2020-03-20 08:57

:bust_in_silhouette: Reply From: Giannis1996

From another forum they told me my mistake was that i have dMoney once as a Singleton and once as a node/instance in your level hierarchy. Either i should remove the dMoney node from my scene or remove it from the AutoLoad(Singletons) tab.

Every Singleton gets loaded once and persists throughout the whole game. Note that in the Remotes list the coins and Global are directly parented to the root Viewport of the game.


Thank you for sharing your answer, even if it came from somewhere else.

DDoop | 2020-03-20 17:13