Search Unity

  1. Check out the Unite LA keynote for updates on the Visual Effect Editor, the FPS Sample, ECS, Unity for Film and more! Watch it now!
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  4. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Multiple Cameras over separate scenes

Discussion in 'Cinemachine' started by tbrowwnnn, Jul 6, 2018.

  1. tbrowwnnn

    tbrowwnnn

    Joined:
    Feb 8, 2018
    Posts:
    2
    Hi there, Im pretty new to Unity and Cinemachine and am just looking for a bit of help.

    Im currently figuring out how to move from one scene to another without losing information when switching between scenes. Instead of using the dont destroy on load method I've been using the additive method where I make my player its own scene. This way I can keep rules and hud options across multiple scenes.

    However, the problem I run into is with the camera. If I put a virtual camera on my scene that my player has loaded into it cannot follow the player since its in its own scene.

    This is resolved if I put the vcam with my player scene however I then am not able to confine my camera anymore since my polygon collider is in the level scene. Seeing as every scene has its own collider it would be difficult to put every collider in the game in my players scene.

    This also causes problems with parallaxing as this uses the camera movement and references different backgrounds images in each separate scene.

    Is there any way to reference my player in a separate scene? Thank you in advance.
     
  2. Adam_Myhill

    Adam_Myhill

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    311
    Cross-scene dependancies / linking is an area which can definitely cause pain. We're working on a binding component which lets you link things between scenes to help manage this but it's not released yet.

    The big question - why are you using so many different scenes? If you need to contain areas so multiple people can work on then, prefabs are a solid method. They handle version control and let different people work on things at the same time (once they're setup of course).

    Otherwise you'll need to either consider keeping your characters and cameras in the same scene(s).
     
  3. tbrowwnnn

    tbrowwnnn

    Joined:
    Feb 8, 2018
    Posts:
    2
    In all honesty I dont know. Am I supposed to just make my entire game as one giant scene? Wont that be difficult to run or taxing on the computer? I mainly am using scenes to separate my levels and my hub worlds and am trying the figure out the best method to accomplish this.

    I am the only person working on this game so it's not so multiple people can work on it at once, its so I can keep my different tiles and rules compartmentalized and keep the game efficient. If there is a better method then by all means please correct me, I've only been working in unity for about 3 months and have zero background in coding and game development. Any feedback or help is appreciated.
     
  4. Adam_Myhill

    Adam_Myhill

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    311
    Environments are a good candidate for separate scenes as they hold the lighting baking information.

    Other than that, it's good to put cameras and characters in the same scene. No performance issues with that.
     
  5. IanItor

    IanItor

    Joined:
    Dec 21, 2017
    Posts:
    1
    The workaround i'm using when working with additive scenes is having core functionality at holder scene and then when i need to turn on some of it at a required scene i compare the build index of a scene at second position in a SceneManager with a build index associated with specific gameobject in a custom info class. Then if the id matches i activate the gameobject and let it do their job.

    I just got another idea: Keep cameras on a separate scenes but move them to your main scene with a SceneManager.MoveGameObjectToScene. But first you have to setup additively loaded scene to be the active one(SceneManager.SetActiveScene), to be able to move gameobject from a current scene. Then set a holder scene back to be active. If you transition to another scene don't forget to destroy that camera since it has no use anymore.
     
    Adam_Myhill likes this.