Forum rules - please read before posting.

Cinemachine workflow

I'll share here what's my workflow (workaround) for using cinemachine and timeline with AC, and see if it's the optimal way of integrating both.
Basically I use the AC camera as the brain, set my gameCamera (currently opsive's TPS) as as an external cinemachine camera, and disabling the cinemachine component on every other virtual camera, and use an AC action to set the priority of the virtual cameras and enabling them if I need them on the gameplay. My action

using UnityEngine;
using System.Collections;
using Cinemachine;

#if UNITY_EDITOR
using UnityEditor;
namespace AC
{

    [System.Serializable]
    public class ActionCinemachineCamera : Action
    {

        // Declare variables here
        public CinemachineVirtualCameraBase CM_cam;
        public int Priority;

        public ActionCinemachineCamera()
        {
            this.isDisplayed = true;
            category = ActionCategory.Camera;
            title = "CM Priority";
            description = "Changes CM priority";
        }


        override public float Run()
        {
            if (CM_cam)
            {
                if (CM_cam.GetComponent<CinemachineVirtualCameraBase>())
                {
                    CM_cam.GetComponent<CinemachineVirtualCameraBase>().enabled = true;
                    CM_cam.MoveToTopOfPrioritySubqueue();
                }
                CM_cam.Priority = Priority;
            }
            return 0f;
        }


#if UNITY_EDITOR

override public void ShowGUI ()
{
            CM_cam = (CinemachineVirtualCameraBase)EditorGUILayout.ObjectField("CM Camera:", CM_cam, typeof(CinemachineVirtualCameraBase), true);
            Priority = EditorGUILayout.IntField("Priority:", Priority);
            AfterRunningOption();
}

public override string SetLabel ()
{
string labelAdd = "Changes virtual camera priority and moves to top queue";
return labelAdd;
}


    }

}
This way I can use Cinemachine in timeline, custom cameras and also cinemachine cameras during gameplay. Any drawbacks ? Suggestions ? What is your way ?

Comments

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.
Do NOT follow this link or you will be banned from the site!