Make UIScene go down just like the background in the GameScene


I basicly have a game in which you go up. I want the UI to go away as you climb, just as it happens with the images/background that i have set in the gameScene.
I guess they have to share the camera or something? How can i make it happen?
Thank you!


Hello @LifeEternal, with phaser-3 you can use multiple scenes on your games. You can see the examples on - scenes where you can search for launch scene which is a quite good example like many others.

Please see the examples and you will get atleast an idea about it.
Bdw they do not share the camera instances. :slight_smile: They have their own cameras.


Hi @LifeEternal,
You can use the registry to share data between scenes. The registry have a event named “changedata” very usefull for your purposes.
Look at this example.


Hi @LifeEternal, if you need your UI elements to move as well, instead of setting the UI in another scene, set them in the same scene but with a higher depth than the rest of the game objects, so they are always in front of everything else. For example your background GOs (GameObjects) occupy depths from 0 to 100, your foreground GOs from 200 to 300 and your UI GOs from 1000 and up.

Also you can set the scrollFactor of the UI elements to give them a parallax feel to them as you go up.