Issue using multiple CM cameras in multiplayer

I have no problem with a single CM camera.
The problem occurs when I use more than one CM camera !



When I log in as a presenter the cameras work.
Only 1st CM camera works when I log in as client.


You’re doing it the hard way.

The child cameras of the StateDrivenCamera are private to it and are controlled by it. If they do not have targets of their own, the child cameras will query the parent camera (in this case the StateDrivenCamera) for the targets. So, you can leave the child camera targets null, and just set the LookAt and Follow targets of the StateDrivenCamera.

Is it possible that the state is always staying on the first camera? Can you prove that your state machine is working properly?

Can you explain with sample code how I should access child CM cameras using StateDrivenCamera?

Actually I was doing this with one camera but
camera.DestroyCinemachineComponent();
I increased it to 3 cameras because the rotation was reset when I said

It depends what kind of access you want. The way you were doing it is ok, but if you just want to set the targets, it’s more efficient to do stateDrivenCamera.Follow = stateDrivenCamera.LookAt = MyTarget. That target will then apply to all stateDrivenCamera child cameras unless they have their own targets explicitly set.

Can you prove that the state machine driving the StateDrivenCamera is changing state? For example, add some Debug.Logs to monitor the state. If it’s working, then the active child camera should change when the state does.

9414761--1318835--upload_2023-10-17_13-12-17.png

I
1st camera at startup //anaKamera
3rd camera when you press B //serbestKamera
2rd camera when you press W //supurgeKamera
When you release W, 3rd camera //serbestKamera
Press B again and select camera 1 //anaKamera
I want it to work.

if(input.getkeyDown(keycode.B)) animator.Play(“serbestKamera”); // CM 3
if(input.getkey(keycode.W)) animator.Play(“supurgeKamera”); // CM 2
if(input.getkeyUp(keycode.W)) animator.Play(“serbestKamera”); // CM 3
if(input.getkey(keycode.W)) animator.Play(“supurgeKamera”); // CM 2
if(input.getkeyDown(keycode.B)) animator.Play(“anaKamera”); // CM 1

If the state-driven-camera is correctly monitoring the state of the animator, then this will be automatic. Try enabling this, and you will see some debug output at the top-left of the screen.

9414833--1318844--upload_2023-10-17_13-45-40.png

I suspect that the “Animated Target” is not set correctly in the state-driven camera, but I could be wrong.

It can be seen in the video I shared
When I enter the game as a presenter, camera transitions work smoothly.
Camera transitions don’t work when I log in as a client
The body variants of the cameras are different.

I don’t see it. It should look something like this:
9414857--1318853--upload_2023-10-17_14-5-26.png

I understand that that is the problem. I don’t think it’s a Cinemachine issue, I think it’s an issue in your setup.

Cinemachine doesn’t care about that. It should work.

So it’s working now?

Client

is Server

When I log in as a presenter the cameras work.
Only 1st CM camera works when I log in as client.
There is no problem with the server
There is a problem with the client

ok, on the client, it looks like the Animator state is not changing. That’s a problem on your side. If the animator state changes, the cameras will follow.

When you compare client and presenter versions, what is the difference in the Animator (the thing assigned to the “Anmated Target” field in the StateDrivenCamera)?

animations are empty
I added animator to StateDrivenCamera to transition


Is this the same object?

9414944--1318883--upload_2023-10-17_14-30-58.png

Is this code changing the state of the right object?

if(input.getkeyDown(keycode.B)) animator.Play("serbestKamera"); // CM 3
if(input.getkey(keycode.W)) animator.Play("supurgeKamera"); // CM 2
if(input.getkeyUp(keycode.W)) animator.Play("serbestKamera"); // CM 3
if(input.getkey(keycode.W)) animator.Play("supurgeKamera"); // CM 2
if(input.getkeyDown(keycode.B)) animator.Play("anaKamera"); // CM 1

Is this the same object? >> Yes
Bu kod doÄźru nesnenin durumunu mu deÄźiĹźtiriyor? >> Yes

Are you sure?:

9414968--1318886--upload_2023-10-17_14-43-33.png

9414968--1318889--upload_2023-10-17_14-43-56.png