Search Unity

How can i change the Cinemachine priority via script??

Discussion in 'Cinemachine' started by Razzy11999, Jun 27, 2020.

  1. Razzy11999

    Razzy11999

    Joined:
    May 17, 2020
    Posts:
    5
    Please some one help me i don't know how to switch between Cinemachine Virtual cameras, because i just want so that i could press a button to change through the Cinemachine Virtual cameras. Please Help!
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    vcam.m_Priority = bla
     
    Zabuska and Johnx140 like this.
  3. Razzy11999

    Razzy11999

    Joined:
    May 17, 2020
    Posts:
    5
    Thanks!
     
  4. Abidtr

    Abidtr

    Joined:
    Feb 3, 2021
    Posts:
    2
    can you share the code
     
    TPEUnity likes this.
  5. vishmaster

    vishmaster

    Joined:
    Apr 4, 2022
    Posts:
    4
    Example:
    vcam.m_Priority = x;

    vcam - you need to declare at the very top of the script and drag the camera in the inspector to the appropriate field
    [SerializeField] CinemachineVirtualCamera vcam;

    x - an integer greater than zero