Cameras don't switch

Hi everybody,

I’m doing around for hours with this now. I have a very simple setup: a main camera with a CineMachine brain on it, two virtual cameras, a timeline with two clips for the two virtual cameras and I would expect that when I run the scene that I get a transiation from the first camera to the second, but the first camera stays active all the time. The brain doesn’t switch from camera 1 to camera 2.
What am I doing wrong?
Example scene is attached.
Thanks in advance!

7004642–828134–CMTest.unitypackage (6.5 KB)

You need to bind your main camera to the CM track in the timeline:

7010329--829270--upload_2021-4-6_7-29-58.png

1 Like

Thanks for your reply!
And how would I “bind the camera to the CM track”?

Drag the main camera into the field indicated in the image

1 Like

Yes, that worked!
My specific problem in the project was, that I am using an asset (HBAO) that creates a second camera below the first one. When I drag the second camera to the CM track then everything is fine.
Thanks a lot for your help!

1 Like

Sorry for bothering you again…
The switching works now. I’m switching from one camera that displays a completely black image to another camera that displays white text on a black background.
First of all, the second image (which is 1920 x 1080, so it should perfectly fit the screen) is displayed a lot bigger (Pic1) and while transitioning from the black image to the black image with white text, the content of the main camera is shining through (Pic2).
Any idea what could be the cause for this behaviour?

Are you using CM Storyboard?

Yes.

That’s the original image displayed by the second camera btw.:

Can you show the inspector for the storyboard of the image that is displaying the wrong size?

For the bleed-through image: that is a known issue, and unfortunately the only way around that is to black out the main camera by having it look at something black.

Here

you are:

What version of CM are you using?

2.7.3
Unity 2019.4.23f

I found the problem: it was again the second camera that is created from the asset. It’s not HBAO, it’s an antialiasing asset that creates a second camera, renders the image in a much higher resolution - hence the distortion - and samples it down for the first camera. Removing the asset and the second camera fixes the problem.
Thanks again for your help and sorry for the hazzle!

Well, now the switching from one camera to the other and back again works, although I have to also animate the priorities of the virtual cameras to get what I want (shouldn’t be placing the clips on the CM track be enough to decide which clip is playing when the cameras have the same priorities?)

But now when I record the track with the Unity recorder the storyboard clips don’t show up at all - it only shows the main camera.
Is it possible to record the track “as is”?

OK, I found out that I have to use a recording track in the timeline.
When I select “active camera” it records only the main camera - like the normal Unity recorder - no storyboards.
When I select “main camera” it records a black screen - although in the game window it shows the correct clips.
When I select “game view” it does not record full screen 16:9, 1920 x 1080.
So what am I supposed to select to get a simple 1920 x 1080 video?

Just to make sure: there is no other camera active. Shouldn’t “active camera” and “main camera” be the same when there’s only one camera?

I have created a unity package with a very simple setup - actually more or less the same setup as the first one in this thread. And I have recorded two clips via a recorder track - the first one with “active camera”, the second one with “main camera”. Both only seem to record the main camera, no storyboards.

btw: if I have a timeline locked and open another scene, the timeline still shows the old timeline…
And even worse: it still seems to have the old camera set as “track camera”!! When I hit record, it records the main camera from the closed scene…
Another minor issue: changes in the timeline are not reflected as “changed” - there is no asterisk after name in the title bar as usual when something has changed; although when closing the scene, one is being asked whether the scene shall be saved or not, so the changes are obviously recognized.
EDIT: I have to correct myself: changes in timeline - for example moving a clip - are NOT recognized as changes. Opening another scene does not ask for saving and changes are lost!

Another issue: at the end of my second transition the rotation of the camera instantly jumps to 380/-148/0. There is no key frame on any of the tracks and even if I mute all tracks this rotation takes place. I even created a new EMPTY cinemachine track - without a clip, muted the old cinemachine track, and this rotation takes place on the first frame.
Any idea where this rotation comes from or any suggestion how to find out where it comes from?

7013968–829840–CMTest.unitypackage (7.52 KB)

OK, to make things easier to fix, I put the whole main scene in a package.
You can download it via this OneDrive link:
https://1drv.ms/u/s!AvTX5a0Y41ck5u8h04eGLzMBlV92_w?e=946IYD

Below the folder “CineMachine” you’ll find a timeline. If you select that you’ll see a camera track at the top. If you move to 10:00 you’ll see that the camera instantly rotates to 380.043/-148.317/0. And you’ll also see that there are no keyframes at that frame.
So where does this rotation come from?

Another annoyance: When you play a timeline to a certain point and then return to 0, the animated values seem to not reset to their original values but stay the way they were when the animation was stopped. At least when there is no dolly track at the beginning. That is VERY confusing (especially for beginners, because it takes quite a while to figure out why everything gets messed up - mainly the camera) and it’s a lot of work to reset everything to their initial values again. That means that all animated values have to have key frames at the beginning of the animation.
Other animation systems that I know (WPF for example) treat the initial values as “implicit key frames”, that means that when you return to the beginning of the animation everything is reset to their initial values automatically.

Thanks for uploading the project. I had to dig into it a little, but it turns out that there is a bug in the TrackedDolly behaviour when there is no Aim component and the Camera Up mode is Default. That’s where the weird rotation is coming from. Thanks for bringing this up, we will fix it right away.

For now, a simple workaround is to put DoNothing in the vcam’s Body section, and add a CinemachineDollyCart behaviour to the vcam, set the path there, and animate that component’s position, like this:

That will make the vcam travel along the path.

Let me address some of the other issues you mention.

If you have a Cinemachine track with an active CM clip on it, that completely overrides the priority system. You should not have to animate the priorities, ever, so long as there is always an active CM clip on the track. If you leave a “hole” as you do in the project you posted, then the priority system becomes relevant within that hole. It’s best to always have a clip, so that timeline has full control of the camera, making the priority system irrelevant.

This is the “hole”, where there is no CM clip, and the priority system takes over:

Recorder: I am not a recorder expert, so can’t really advise about that. Perhaps someone else on this forum knows and can answer. It seems to me that to include the canvases you have to record the game view. I don’t know why the resolution is wrong, but surely there is a way to get it right or it’s effectively useless. Is it possible that your game view needs to be the correct size on your display when recording?

Perhaps you can ask on the recorder forum: Unity Engine - Unity Discussions

Timeline: You bring up several issues, and I suggest that you post them on the Timeline forum. Here we focus on Cinemachine-specific things. Timeline forum is here: Unity Engine - Unity Discussions

1 Like