Search Unity

Triggering camera blends through scripts

Discussion in 'Cinemachine' started by petey, May 1, 2019.

  1. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,824
    Hi there,

    I feel a bit silly asking this but surprisingly I couldn't find a solution elsewhere.

    I've set up some custom blends, just wondering how I actually trigger them through scripts. The manual just says to use custom blends. https://docs.unity3d.com/Packages/com.unity.cinemachine@2.2/manual/CinemachineBlending.html

    I'm pretty new to Cinemachine so I might be getting something fundamentally wrong here.
    Any help would be much appreciated,
    Pete
     
    Vlad_Iliescu likes this.
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    A blend specifies what happens when the active camera changes from camera A to camera B. To see the blend in action, make a new camera active. There are a few ways to do this:
    1. Activate incoming vcam's game object and deactivate outgoing vcam's game object. You can to this at the same time from a script
    2. Or, set the incoming vcam's priority to something higher than the outgoing one
    3. Or, give the incoming a higher priority and activate its game object, leaving the other one alone. To transition back, deactivate it.
    Note that if no custom blend settings exist for a specific vcam pair, the default blend setting will be used. I mention this because you have set both settings to the same thing.
     
    Vlad_Iliescu likes this.
  3. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,824