Search Unity

2.0 camera destroyed problem

Discussion in 'Cinemachine' started by jordanGilbert, May 21, 2018.

  1. jordanGilbert

    jordanGilbert

    Joined:
    May 21, 2018
    Posts:
    1
    I am having a problem when working with Cinemachine virtual cameras and multiple scenes in the editor.

    What I have is a "master scene" that contains several shared game objects, like the main character or the camera. This scene loads a playable area that includes all the virtual cameras for that area. When working on the editor both scenes are loaded in the hierarchy view and the "master scene" set as the active scene. This allows me to work on the playable area, hit run and test it.

    But in the process of unloading the playable area scene and loading it again by the "master scene" the CinemachineCore.mActiveCameras keeps a list of destroyed cameras. Probably the list while in edit mode. And the cameras does not work in game anymore.

    I can work around it by manually removing the playable area scene from the hierarchy before running the game and everything works just fine. But it might be good to have a clean transition between in-editor and in-game of the CinemachineCore state.

    I could not figure out completely why are destroyed cameras still listed but it looks like CinemachineVirtualCameraBase.OnDisable() calls UpdatePriorityQueueStatus and that is going through the path that adds the camera to CinemachineCore.

    Is anyone experience this or is it a known issue? Is there a dev that can help me with it? Should I report it as a bug?

    Thank you!
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    CinemachineVirtualCameraBase.OnDisable() calls UpdateVcamPoolStatus(), which removes the vcam from mActiveCameras, and only adds it back if isActiveAndEnabled returns true. So it looks like your vcam is being destroyed without being disabled. How is that happening?