So I’m making a small multiplayer game and for the player camera’s I use cinemachines.
BUT when another player joins the scene the cameras get switched.
Codewise everything is fine because when I don’t use cinemachine it doesn’t happen.
So it has something to do with the cinemachine scripts and I’m wondering how I could change this.
Any help/suggestions are appreciated
Can you say something about how you’ve set up your CM cameras? How/when to they get instantiated? How do you set up the targets? What happens when a new player joins? What do you want the cameras to do?
Hey I have the same problem.I set up my CM cameras using unity official tutorial on YT.Target is my player I dont have any offsets.When another player joined first player camera teleports to second camera.I’m creating first person shooter and want to camera stand in the same position as in a prefab
If you just instance a player, then nothing should happen to the camera. However, if the prefab that you instance includes a CM VirtualCamera somewhere, then that new camera will take over, unless it has lower priority than the current one. Try raising the priority of the first player’s vcam after instantiating it.
I was also having this issue. I solved it by disabling the player camera and CM camera and enabling them on Awake if PV.ismine when instantiated. This seemed to fix it.
Can you simplify this i cant understand
The Virtual Camera with the highest priority in the scene takes control of the Main Camera, always. In the event that multiple Virtual Cameras have the same highest priority, then the most-recently-created one wins.
Hello Sir, I want to know whether you have a script I understand much faster in a script.
Thank You.
Don’t know if it will work for you, but here is my code. I have my virtual camera as a child of my player with it being active.
private void Awake(){
view = GetComponent();
if (!view.IsMine && playerCamera != null)
{
playerCamera.SetActive(false);
}
}
Thank you so much, you saved my life
hello may I ask if you created another script (used the code that was provided) then attached it to the main camera?
also did you disable the main camera and virtual camerafirst? thank you