Search Unity

Photon Camera Issues

Discussion in 'Scripting' started by BubyMB, Jun 12, 2016.

  1. BubyMB

    BubyMB

    Joined:
    Jun 6, 2016
    Posts:
    140
    Hey guys! Quick little problem I can't find out how to fix..
    I posted a while ago on Photon forums but no one is on at this time of day. and Unity forums is much more active.
    I am having a problem when multiple players join their cameras get switched, I will give an example with 2 players:

    the first player joins, their camera is perfect and movement it perfect;
    the second player joins, the first player's camera switches to the first player's and vice versa.

    So here is my Network Manager;
    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class NetworkManager : MonoBehaviour {
    5.  
    6.     private string VERSION = "V1.0";
    7.     public string roomName = "MR1";
    8.     public string playerPrefabName = "Player";
    9.     public Transform Spawn;
    10.  
    11.     void Start () {
    12.         Debug.Log("Start");
    13.         PhotonNetwork.ConnectUsingSettings(VERSION);
    14.     }
    15.  
    16.     void OnJoinedLobby() {
    17.         Debug.Log("Joined Lobby");
    18.         RoomOptions roomOptions = new RoomOptions() { isVisible = false, maxPlayers = 6 };
    19.         PhotonNetwork.JoinOrCreateRoom(roomName, roomOptions, TypedLobby.Default);
    20.     }
    21.  
    22.     void OnJoinedRoom() {
    23.         Debug.Log("Joined Room");
    24.         GameObject myPlayer = PhotonNetwork.Instantiate(playerPrefabName, Spawn.transform.position, Spawn.transform.rotation, 0);
    25.     }
    26. }
    27.  
    28.  
    29.  
    I would also like to implement a smooth camera follow script as I am just putting the player into an empty object with the camera which sort of makes it choppy
     
  2. BubyMB

    BubyMB

    Joined:
    Jun 6, 2016
    Posts:
    140
    Ok, found a great video that shows how to fix this..
     
  3. SMoyana

    SMoyana

    Joined:
    Jun 6, 2021
    Posts:
    1
    This Video Totally fixed my issue, Thank You So Much!
     
  4. tskipurishvilimakrina

    tskipurishvilimakrina

    Joined:
    Nov 20, 2021
    Posts:
    7
    Wow that helped! Thanks!!!
     
  5. Navillus-sullivan

    Navillus-sullivan

    Joined:
    Jan 21, 2023
    Posts:
    1
    If anyone is looking back on this, 19:00 is when the problem is fixed.:)