I made the whole multiplayer tutorial with Capsules, but if I connect cameras to them (like an fps camera) I can control only the client and see only what it see on each display. When i start the server everything is ok, until client arrives. I browsed may topics, but the “NetworkView.isMine” solution is out of date, because NetworkView Component has been removed in Unity5 and above.
I made many script-modifying, but cannot fix this problem. Has Anybody a working solution?
if (!isLocalPlayer)
{
return;
}
also doesn’t work. If I remove the cameras, it works well :(((((
I don’t have enough information about your situation to help you in regards to ensuring only the owner can control its player, but just make sure that LocalPlayerAuthority is ticked and in the control script !IsLocalPlayer returns rather than continues.
In regards to stopping camera conflicts, I’m not familiar with the networking tutorial but I assume you have a camera childed to a player prefab.
By default, have the entire camera gameObject deactivated.
Create a new script and add it to the player and something roughly like this should do the job:
using UnityEngine;
using System.Collections;
using UnityEngine.Networking;
public class EnableLocalCamera: NetworkBehaviour {
//Fill this field in the inspector with the childed camera.
[SerializeField]
private GameObject playerCamera = null;
public override void OnStartLocalPlayer ()
{
playerCamera.SetActive(true);
}
}