Hello
In my 2D main-scene i instanced the 3d game-scene.
than i instanced the level-scene in the game-scene through script-code and the player-scene in the level-scene the same way.
I need this setup to display two cameras at once, which use sprites as screens.
than the levels are instances to switch easily from one to another and the player is an instance to need only one player-scene for the whole game.
i tried
game.level.player.get_node("Viewport/Camera")
the first three names in this line are the variables, in which each instance is stored in the script of their parent-scenes.
and
game.get_node("InGame/Level_1/Walls/Player/Viewport/Camera")
Everything, that uses grid calculations, is child of the GridMap-node "Walls" in the level-scene, that provides all grid-calculations in it´s script.
First variant gives an invalidgetindex - error.
Second variant gives a callfunctiongetviewportatnullindex - error.
how can i now access the player scene in the main scene?
It´s because i want to play the view of the player-cam on a sprite in the 2D-main-scene.
Now i think, maybe the call for finding the camera runs faster, than the nested instance-steps are done.
So i thaught, maybe i can let the player emmit a custom signal at the end of it´s ready-function.
But how do i now connect the signal to the 2D-main-scene?