Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Cinemachine now working correctly after map change

Discussion in 'Cinemachine' started by ademakyazici, Aug 31, 2021.

  1. ademakyazici

    ademakyazici

    Joined:
    Mar 26, 2020
    Posts:
    5
    In my game I have different maps in the same scene. In each map, there are different cinemachine brains to have different camera movements. When the player travels, I simply deactivate and activate cameras. When I travel from one map to another for the first time, everything works ok. But the second time I do that, everything fails. For example:

    Game opens at village. No problem. Village => Forest for the first time. No problem. Forest => Village. Camera only show player and UI. Everything else is not visible. Cinemachine enabling disabling system works, blending system works. But village objects are all missing. All I can see is the player(which is being teleported between maps, I don't know why but I believe that is why it can be seen.) and the UI.

    What might be the issue? If I enable and disable them from the inspector, everything works. But when it is done through the script it fails. Or if I deactivate the cinemachine brain from camera, it works. What might be the issue?
     

    Attached Files:

    Last edited: Aug 31, 2021
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    I don't quite understand what you're doing.

    Here is how I would set it up:
    Have only a single Camera, with a CM Brain on it.
    For each map, create a CM vcam that will track the player or otherwise behave as is appropriate.
    When you enable/disable a map, also enable/disable the vcam.