Search Unity

Smooth transition from one camera to another with button click

Discussion in 'Cinemachine' started by LazyGoblinCody, Jan 27, 2018.

  1. LazyGoblinCody

    LazyGoblinCody

    Joined:
    Mar 18, 2015
    Posts:
    66
    I have to try to figure this out for a day now.

    I am trying to have the main menu where, when a button clicks the camera will smoothly transition to another camera as if I used the timeline to do so. So far though it just cuts to the camera immediately when I enable it.

    Any help is greatly appreciated.
     
  2. Adam_Myhill

    Adam_Myhill

    Joined:
    Dec 22, 2016
    Posts:
    342
    Simply enable a vcamera - you must keep the other one on - and just turn on / enable some other camera. The old one needs to stay on so it exists for the duration of the blend to the new one.

    Add a yourNewVcam.SetActive(true); bit to your script which runs when clicking the button.

    Cameras of the same or higher priority will be enabled and blended to based on the Default Blend or a Custom Blend

    The default blend is set to 2 seconds. You can make custom blends here, on the Cinemachine Brain component on the main camera
    upload_2018-1-26_20-27-27.png

    You can setup custom blends per any two cameras as well, as shown above, even including wild cards.