How to change cameras when changing scenes?
I am working on my game project and I want to change the cameras when I am changing scenes with scenemanager.
I have different size of 2d maps and each one of them has a different camera(I think) because I set the bounds around the maps and the cameras will stay inside of the map so the size of the camera for each map might vary.
Right now I am trying to make the scene-changing to work but it is really awkward that my previous camera from the previous map will affect the next scene's camera.
Is there a way to fix this? I wonder if it is something like turn off the previous camera when changing the scene and then active again when going back? Please help. Thanks a lot.
Answer by tormentoarmagedoom · Jul 06, 2018 at 10:14 AM
Good day.
By defaut, each scene is independent from other scenes. So each scene can have a camera configured for that scene. And when you load the new scene, all objects, included caneras, are replaced, so... Where is the problem?
Hi thanks for answering.
Ex. previous map = 3x3 current map = 7x7
When I enter a new scene, the camera in the new scene has the size of the previous map. In the example above, the previous camera is smaller than the current camera so after entering the new scene, my player can move on the current map but the camera won't follow the player beyond the size of the previous map. The camera will only follow the player on the current map with a 3x3 camera. I am not sure if it has something to do with the bounds I set up.