There are a better way to get variables from a singleton?

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

I have written codes like this:

var p = debug.PLAYER # PLAYER is a node I got by assigning with self keyword
p.global_position = get_parent().get_node("spawnPoint").global_position

For instantiating nodes:

var ref_node = debug.node
var child_node = ref_node.instance()
add_child(child_node)

But I want a better way because the follow doesn’t work:

var child_node = debug.node.instance()
add_child(child_node)

It returns an error, something like “instance function doesn’t exists in debug singleton”

Could you give us the full error text produced?
Please and thanks.

SIsilicon | 2018-12-15 14:17