Multi player cameras - don't just need it fixed - need to understand :)

Good morning answer people :slight_smile:

I am debugging my multiplayer cameras and failing to understand why they are not working correctly.

I believe this is true - and want to make sure I have my understanding correct.

  1. I am using NetworkLobbyManager to start the game.
  2. Network lobby starts “scene2” - all players spawn in
  3. The last player to spawn in grabs the camera that is capable of looking around/up/down - all other cameras are fixed in place.
  4. All players move correctly.
  • I am working from Mike Geig’s excellent tutorial Merry Fragmas 3.0 - so my player object:

89438-2017-03-06.png

Through the example we set inactive the FirstPersonController script as it will be enabled through the ToggleEvent when isLocalPlayer is true. So, here is how the player script is dealing with Cameras:

  • Main Camera is untagged but active

  • In the declaration of our player class: GameObject mainCamera;

  • In the start method: mainCamera = Camera.main.gameObject;

  • The start method invokes EnablePlayer();

  • This is the entire EnablePlayer() method

     void EnablePlayer()
     {
         if (isLocalPlayer)
         {
             playerIDNum = int.Parse(GetComponent<NetworkIdentity>().netId.ToString());
             Debug.Log("===> Enable player method... Player " + playerIDNum.ToString());            
             SetPlayerColor(playerIDNum);
      
         }
    
         if (isLocalPlayer)
             mainCamera.SetActive(false);
    
         onToggleShared.Invoke(true);
    
         if (isLocalPlayer)
             onToggleLocal.Invoke(true);
         else
             onToggleRemote.Invoke(true);
     }
    

The camera I think should be active for each client player is the one attached to the FirstPersonCharacter object nested under the FirstPersonController Object.

Mr. Geig, you sir are a rock star.

The issue was this - I had the camera checked off on FirstPersonCharacter and had the gameObject checked ON (as you can see in the screen shot above). By turning OFF the FIrstPersonCharacter object and turning the child camera back on (verifying the tag MainCamera on both the scene camera and the FPC camera.