Your singleton(s) are siblings of your main_scene.
If the top node of your main_scene is called Game
you access it with an absolute path get_node("/root/Game")
.
if you have a singleton named Global
you access it with an absolute path get_node("/root/Global")
.
But know that singletons call _ready()
before the mainscene, so you wont be able to access the mainscene within a singleton's _ready()
.
You can, however, define a var controlSample
in your singleton script. In the main_scene's script which handles this object, you can have it define itself to the singleton in its _ready()
:
func _ready():
Global.controlSample = get_node( "SamplePlayer2D" )