Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Get virtual camera status in code?

Discussion in 'Cinemachine' started by Efril, Mar 17, 2021.

  1. Efril

    Efril

    Joined:
    Aug 31, 2013
    Posts:
    79
    Hello all. I'm creating a simple script that intended to adjust X axis value and Follow offset values of a Virtual Camera in order to get nice automatic orbiting to record videos for a game trailer. I have to make this script working only when the Virtual Camera is actively controlling the main camera of my scene. Documentation of
    CinemachineVirtualCamera clearly states:
    And these statuses are visible in UI of Virtual Camras:
    VirtualCameraState.png
    But how can I get it in my C# code? May be I'm a bit dumb or inattentive but I can't find it in the documentation.
    Thanks in advance.
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,233
    Try
    CinemachineCore.Instance.IsLive(vcam)
     
    DWDanielLee and Efril like this.
  3. Efril

    Efril

    Joined:
    Aug 31, 2013
    Posts:
    79
    Yes, it's working. Thank you very much!
     
    Gregoryl likes this.