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;
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;
}
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
Hi Guys,
Thanks for putting this together. I'm looking into extending this so that in integrates with AC's Default Camera Switch Action.
I'd like to have it detect whether the cam has a cinemachine component on it, and if it does, raise the priority, while also switching the cam.
Then I'd like to have it revert the priority back to the original number.
I've been hunting around for the default Camera Switch Action code. I think taking it as a base, it should be fairly simple to put the rest together. Do you know wher eI can find it?
Thanks!
Sounds intereseting, @juanelo_dev.
You can edit the script of any Action via its cog menu in the ActionList Editor window. The Camera: Switch Action is stored in ActionCamera.cs - which you can subclass if you want to make an Action that derives from it.
However, it's not just the Action that's used to switch camera - cameras are also set when entering scenes, and loading save games. From what you've described, it would be better to hook into the OnSwitchCamera custom event instead - which will allow you to run custom code whenever the camera is set. Something like:
This is great, @ChrisIceBox. Thanks!
Create a new C# script with the above code and attach that to your AC MainCamera, it will attach a CinemachineBrain component if there isn't already one. Next add a CinemachineVirtualCamera component to your AC GameCameras and voila, full cinemachine control. I'm using it to do depth of field tracking, handheld noise, and I'm going to set it up to use composer to follow the player around the scene but still use the deadzones.
@rtwarner THANK YOU!! This is so much better, I came here hoping for this exact solution. Manually setting the priority gets really messy down the line, this is perfect
Awesome, @rtwarner ! Did you ever end up doing an update on this?
I didn't use the official Cinemachine bridge.
I took @rtwarner's approach and extended it. And I created a new "CM Action: ActionCamera".

Looks good, @zfh2773!
A rudimentary Cinemachine integration can now also be found on the AC Downloads page.
I've attempted both solutions, above.
*https://adventurecreator.org/forum/discussion/comment/41929/#Comment_41929
*https://adventurecreator.org/downloads
My Experiences:
AC Cinemachine Integration:
-Gets stuck on import and never completes.
rtwarner code:
-Works until an ActionList 'Camera>Switch Action' runs (at which point, the CineMachine LookAt gameObject is unassigned even though SetCMPriority.cs has 'LookAt' ticked.
Note:
It's likely user error, but a pointer in the right direction would be greatly appreciated.
What are your AC/Unity and Cinemachine package versions? The integration on the Downloads page requires the latest AC version to be installed.
Environment / Versions:
Unity 2023.2.15f1
Cinemachine 2.9.7
Adventure Creator 1.80.5
Instructions to reproduce:
* Create new Unity 2023.2.15f1 3D (Built-in) Project.
* Package Manager > Install Cinemachine 2.9.7
* Package Manager > Install Adventure Creator 1.80.5
* Visit AC Downloads > Download AC Cinemachine Integration
* Drag AC Cinemachine Package into Projects Folder
* Template_CinemachineIntegration > Inspector > Apply
* Console displays error: 'ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index'
* Cinemachine Integration Template > Gets stuck and never completes.
Thanks for the details - though I'm having trouble recreating this.
Could you let me know the Console's error message in full - stacktrace included?