Unity 3D Multiplayer camera problem

Hi everyone.
I working on a multiplayer project. I can create a server and I can join to the server with no problem. If I start a server I can control my Player on the map, the camera follows me.
BUT
If I start the .exe file and join to the server the second player took the control over the camera. Both of the players are controllable but the host lost his camera.

Sorry for the long post. :confused:

I have 2 scripts:

Player.cs:
using UnityEngine;
using System.Collections;

public class Player : MonoBehaviour
{
public float speed = 10f;

void Update()
{
	if (networkView.isMine)
	{
		InputMovement();
	}
}

void InputMovement()
{
	if (Input.GetKey(KeyCode.W))
		rigidbody.MovePosition(rigidbody.position + Vector3.forward * speed * Time.deltaTime);
	
	if (Input.GetKey(KeyCode.S))
		rigidbody.MovePosition(rigidbody.position - Vector3.forward * speed * Time.deltaTime);
	
	if (Input.GetKey(KeyCode.D))
		rigidbody.MovePosition(rigidbody.position + Vector3.right * speed * Time.deltaTime);
	
	if (Input.GetKey(KeyCode.A))
		rigidbody.MovePosition(rigidbody.position - Vector3.right * speed * Time.deltaTime);
}

}

NetworkManager.cs:

using UnityEngine;
using System.Collections;

public class NetworkManager : MonoBehaviour {

private const string typeName = "UniqueGameName";
private const string gameName = "RoomName";
private HostData[] hostList;

private bool isRefreshingHostList = false;
public GameObject playerPrefab;
public GameObject Camera;

void OnConnectedToServer()
{
	Debug.Log("Server Joined");
	SpawnPlayer();
}

private void SpawnPlayer()
{
	Network.Instantiate(playerPrefab, new Vector3(0f, 5f, 0f), Quaternion.identity, 0);
	}
	
	void OnGUI()
	{
		if (!Network.isClient && !Network.isServer)
	{
		if (GUI.Button(new Rect(100, 100, 250, 100), "Start Server")){
			StartServer();
			Debug.Log("1");
		}
		
		if (GUI.Button(new Rect(100, 250, 250, 100), "Refresh Hosts")){
			RefreshHostList();
			Debug.Log("2");
		}
		
		if (hostList != null)
		{
			for (int i = 0; i < hostList.Length; i++)
			{
				Debug.Log("Zsírlézer");
				if (GUI.Button(new Rect(400, 100 + (110 * i), 300, 100), hostList*.gameName))*

_ JoinServer(hostList*);*_

* }*
* } else Debug.Log(“asdasd”);*
* }*
* }*
* private void RefreshHostList()*
* {*
* MasterServer.RequestHostList(typeName);*
* Debug.Log (“RefreshHostList”);*
* }*

* void OnMasterServerEvent(MasterServerEvent msEvent)*
* {*
* if (msEvent == MasterServerEvent.HostListReceived) *
* hostList = MasterServer.PollHostList();*
* }*
* private void StartServer()*
* {*
* Network.InitializeServer(4, 25000, !Network.HavePublicAddress());*
* MasterServer.RegisterHost(typeName, gameName);*
* //MasterServer.ipAddress = “127.0.0.1”;*
* }*
* void OnServerInitialized()*
* {*
* Debug.Log(“Server Initializied”);*
* }*
* private void JoinServer(HostData hostData)*
* {*
* Network.Connect(hostData);*
* }*
* // Use this for initialization*
* void Start () {*

* }*

* // Update is called once per frame*
* void Update()*
* {*
* }*
}

I had this problem before, and soon I find out that you should not put the camera into the Player.
119857-capture.png

and in this camera, I make two script for it

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace S3
{
    public class CameraFollow : MonoBehaviour
    {
        public Transform playerTransform;
        public int depth = 0;
        // Update is called once per frame
        void Update()
        {
            if (playerTransform != null)
            {
                transform.position = playerTransform.position + new Vector3(0, 0, depth);
            }
        }
        public void setTarget(Transform target)
        {
            playerTransform = target;
        }
    }
}

and the next script

using UnityEngine;
using System.Collections;
using UnityEngine.Networking;

namespace S3
{
    public class CameraController : NetworkBehaviour
    {

        // Use this for initialization
        void Start()
        {

        }

        // Update is called once per frame
        void Update()
        {
            float x = Input.GetAxis("Horizontal") * Time.deltaTime * 150.0f;
            float z = Input.GetAxis("Vertical") * Time.deltaTime * 3.0f;

            transform.Rotate(0, x, 0);
            transform.Translate(0, 0, z);
        }
    }
}

so, it will become a FPS game, hope it works.

The following is a useful tutorial:
https://unity3d.com/learn/tutorials/s/multiplayer-networking