Multiple Cinemachine Brains causes horrible-ness

So I need some guidance in the proper way to use multiple brains. With one brain in the scene Cinemachine functions perfectly. With more than one it freaks out and spins the cameras wildly. I want some cameras to be cuts, some to be blends, but using the blend list relies on the assumption that cameras already existed in the scene and I set up all the blends before hand.

I dynamically create my cutscens / cameras (ala Mass Effect)

My main interest is in using the Cinemachine Track in timeline, which seems to naturally want to have a static reference to the brain. But that reference I don’t necessarily know where its going to be at run-time. I really wish Cinemachine and timeline could work together globally alter the blend type. I just don’t have the kind of game where everything is static and in one big scene.

Is there no way to use multiple brains on the same layer?

Hello,

I think this is what you’ll need. It will allow you to bind the brain component of a camera to a cinemachine track. You can use any Camera GO, not just Camera.main.

    PlayableDirector director = gameObject.AddComponent<PlayableDirector>();
    TimelineAsset timeline = ScriptableObject.CreateInstance<TimelineAsset>();
    director.playableAsset = timeline;
    cinemachineTrack = timeline.CreateTrack<CinemachineTrack>(null, "Cinemachine track");
    director.SetGenericBinding(cinemachineTrack, Camera.main.GetComponent<CinemachineBrain>());

ah So i should write a component that looks for all cinemachine tracks under the heirarchy and fills in the brain with the current global brain?

I think the Cinemachine Track is probably overkill for this. I bet im better off just writing custom timeline tracks to alter the global brain’s blend modes

would LOVE if a simple track like that existed!

I don’t understand why you need multiple brains. The paradigm is this:

  • 1 Unity Camera, with a brain on it.
  • Multiple vcams, on separate game objects. The active vcam drives the Unity camera at all times.
  • When you have an active CM Timeline track for the brain, its clips override the current active vcam. Blends are controlled by overlapping the clips in the timeline asset.
  • the previous post described how to dynamically bind scene objects to timeline assets

If that doesn’t help, maybe you can describe a little more fully what you’re trying to achieve, and where it’s going wrong.

Not a great idea to alter the brain’s global blend mode IMO. Better to set up a Custom Blends asset on it, and configure it for the different blends you need. Vcam lookup is name-based for the blends, so just having a good naming system for them will accomplish the dynamic bindings.

interesting… didn’t even realize it was string based! Does it do anything kind of filtering? Can I say… “anything with CUT in the name” ?

so it doesn’t seem to be string based. It creates a magic enum out of scene assets. my cameras are all contained under a prefab. So how does it work under the hood? Can i just enter the string somewhere?

3492740--278158--upload_2018-5-10_15-26-29.png

so heres the issue… it works only if the cameras are in the scene

so i built this! omg amazing!
3492744--278159--upload_2018-5-10_15-28-53.png

then the moment i run the game and those elements aren’t in the scene anymore it changes to this

3492744--278160--upload_2018-5-10_15-29-23.png

sadly this makes the blend lists useless unless you have cameras ALWAYS in the scene. so you cant do any kind of dynamic stuff with it

will code some custom solution i guess

ok a good custom solution for this is to make N blend settings for whatever kind of blends you want and then at runtime SET the global brain to these settings

sry its a pic, but basically this works well for “make a cutscene then blend back to gameplay”