Question by
Hedonsoft · Jan 11, 2017 at 02:56 AM ·
cameranetworking
Scene Camera doesn't switch to Player cam on spawn
I'm following some tutorials for Unet on Youtube but they all show that when the game is run, the main scene camera automatically switches to the player's fps cam when they are spawned but mine doesn't. I have a camera tagged Main Camera on my player prefab and it's spawned by the Network Manager. Is there step I'm missing?
Comment
Are all other cameras in the scene removed or set to a different Tag?
Best Answer
Answer by AurimasBlazulionis · Jan 11, 2017 at 06:41 AM
On your character, create a NetworkBehaviour script which has the following lines in the Start function
if(isLocalPlayer)
Camera.main.gameObject.SetActive(false);
Make sure your players camera is not tagged as MainCamera. Also, you will still have to disable cameras on other players cameras. So to do so, add these lines after the last two
else
GetComponentInChildren<Camera>().gameObject.SetActive(false);
Your answer