Search Unity

Camera Did not Return to Main Camera After Timeline tracks complete

Discussion in 'Cinemachine' started by whiteleon, Mar 25, 2018.

  1. whiteleon

    whiteleon

    Joined:
    Dec 25, 2017
    Posts:
    4
    I use prefabs to instantiate a camera as main camera with cinemachine brain script attached.

    Then, I use timeline.SetGenericBindings to set reference to the cinemachine track in the timeline that I previously created.

    The problem is when the timeline clip complete, the camera will set back to the first vcam in the cinemachine track instead of the main camera.

    Is there any way to fix it? Is there any API I should implant to set main camera to cinemachine reference?(prefabs attaching cinemachine brain is not enough??)

    Thanks for all your helps.
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    Just to make sure i understand you correctly: You instantiate a camera with a CM brain, then drive that camera from the timeline with vcams, and when the timeline ends you want something to happen.

    I can say a couple of things here, maybe it will help. When you have a Camera with a CM brain, that camera needs to be driven by a vcam. You're not supposed to drive that camera's transform directly. The current active vcam controls it (that's what the brain is for). The CM tracks in timeline communicate directly with the brain to override the current active vcam.

    What you need to do is to instantiate another vcam, not driven by timeline, that will become the active vcam when the timeline ends. Give that vcam a higher priority to make sure it becomes the active one (alternatively, you can deactivate the timeline vcams - they don't need to be active when timeline is using them).
     
    Last edited: Mar 25, 2018
    FolksGames and Muhammad-Saadat like this.