Rotation problem in multiplayer
Options
Hi, I'm new in multiplayer and photon in general.
I have an issue, everythink work fine, but when a second player connects the camera starts to rotate
How it rotates Image (Player 1 (server) )
How it should be Image ( Player 2 )
I have Camera with cinemachine 2d camera attached in the project and in the player prefab
Project structura image
Player Prefab
In PhotonManager the main camera is attached
In PlayerNetworking the player camera is attached
Thank you very much.
I have an issue, everythink work fine, but when a second player connects the camera starts to rotate
How it rotates Image (Player 1 (server) )
How it should be Image ( Player 2 )
I have Camera with cinemachine 2d camera attached in the project and in the player prefab
Project structura image
Player Prefab
In PhotonManager the main camera is attached
public class PhotonManager : Photon.MonoBehaviour
{
[SerializeField] private GameObject player;
[SerializeField] private GameObject lobbyCamera;
// Start is called before the first frame update
void Start()
{
PhotonNetwork.ConnectUsingSettings("1.0");
}
void OnJoinedLobby()
{
PhotonNetwork.JoinOrCreateRoom("Room", new RoomOptions() { MaxPlayers = 2 }, TypedLobby.Default);
}
void OnJoinedRoom()
{
PhotonNetwork.Instantiate("PlayerNet", player.transform.position, Quaternion.identity, 0);
lobbyCamera.SetActive(false);
}
}
In PlayerNetworking the player camera is attached
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerNetworking : MonoBehaviour
{
[SerializeField] private GameObject playerCamera;
[SerializeField] private MonoBehaviour[] scriptsToIgnore;
PhotonView photonView;
void Start()
{
photonView = GetComponent();
Initialize();
}
private void Initialize()
{
if (photonView.isMine)
{
}
else
{
playerCamera.SetActive(false);
foreach (MonoBehaviour item in scriptsToIgnore)
{
item.enabled = false;
}
}
}
}
Thank you very much.
0