unity instantiated player with photon attaching to cinemachine

734 Views Asked by At

So before i used photon i used to have the player attached to the cinemachine camera in the inspector but now that im instantiating the player at runtime i really have no clue how that works, im making a 2d topdown game so i cant have the camera on my player prefab because it will rotate all crazy when i move my mouse.

is there a way to have all players each their own camera? i also dont want to destroy other people's cameras but disable them so i can re enable them later (spectating).

thanks!

2

There are 2 best solutions below

0
On BEST ANSWER

The solution seemed to be really simple, i simply disabled the camera objects by default and enabled them if IsMine is true

        if(view.IsMine)
    {
        myCinemachine.SetActive(true);
    }
    else
    {
        myCinemachine.SetActive(false);
    }
0
On

did you put this code in the update or start

i mean this code

if(view.IsMine)
{
    myCinemachine.SetActive(true);
}
    else
{
    myCinemachine.SetActive(false);
}