I would like to have a camera with a perspective which renders all sprites with a camera flag (I used USER2 for this camera).
Furthermore I’d like to have a background which doesn’t get affected by the perspective camera so I created a normal camera with another camera Flag (USER4).
Now it seems like that the perspective camera is always rendered before the one I use for the background and thus the background image is in front of the game image.
Thank you for your answer but the swapping of the camera flags does not change anything at all.
The outcome is still the same and the “gameSprite” remains behind the “backgroundSprite”
I tried creating the cameras in another order as you suggested but it only works if the cameras are “equal”. Meaning that it only works if I have for example two default cameras and two perspective cameras.
But a mixture of both leads to the initial result where the regular camera is always rendered before the perspective camera, regardless of the order I add them to the scene.
I will add the updated code with two equal cameras, if someone wants to try it out.
Hi @slackmoehrle,
I’m glad you are writing a camera tutorial. I think a lot of people will benefit from this!
Yes, I’ making a 2D game. It is kind of a tabletop game, seen from above with multiple playing fields.
I wanted the playing fields to be rendered by a perspective camera to zoom in and out easily, do translation of the camera and maybe rotate it.
I also wanted the game to have a background image which covers the whole screen and stays as it is behind of everything else.
Furthermore I’d like to have some ui elements in front of everything.