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

Cinemachine state-driven camera vs enabling/disabling cameras manually

Discussion in 'Cinemachine' started by Serjiosalva, Mar 5, 2020.

  1. Serjiosalva

    Serjiosalva

    Joined:
    Mar 5, 2020
    Posts:
    4
    Hello everyone,,
    I have a turn-based battle scene where I need to switch between different virtual cameras based on the current phase of battle, e.g. player attack vs enemy attack.

    I'm currently assigning cameras to different phases and enabling/disabling them during the phase. However, it sounds like this https://snaptube.cam/ 9apps might be a good candidate for a state-driven camera.

    Is there a benefit to using a state-driven camera vs just enabling and disabling cameras manually in scripts? I'm having trouble figuring out where the actual difference is.

    edit: Clarification: I'm already using cinemachine. I'm just trying to determine if there is a difference between using a state-driven camera vs virtual cameras that get enabled/disabled.
     
    Last edited: Aug 25, 2021
  2. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    856
    Hi
    It does sound like a good candidate for state-driven camera. :)

    The big benefit would be that you don't need to write extra code to manage changing and blending between vcams depending on state. But if you have already scripted the logic and are happy with it, then possibly you can stick with it, if you don't plan on expanding it.

    Also, I generally change priorities of vcams, rather than disable/enable.
     
    Last edited: Mar 5, 2020
    Adam_Myhill likes this.
  3. Adam_Myhill

    Adam_Myhill

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    342
    @Serjiosalva the State Driven Camera module was originally designed to make it simple to link cameras with animations. For example, the Gears of War 'Roadie Run', a shaky, super wide FOV camera for when you're sprinting is a snap to hookup with a SDC as that animation event is probably already exposed.

    Since your battle phases most likely have multiple different animations running during them, the SDC would only work if you also have a state for each battle type which stays on for the desired duration of that battle phase. If so, great, SDC is probably a great way to go.

    If not, if you don't have a state which lasts for the battle duration, gaborkb's point above about setting camera priority during the battle stages is the way to go as you can control the cameras to perfectly line up with your battle states.

    Let us know how it goes.
     
    gaborkb likes this.