So I’m trying have my server change some bools specific to my player controller, and I’m pretty sure the code works, but I think something is wrong with my components. My player prefab network identity doesn’t fix it when I uncheck local player authority. The bools effect the mesh renderer of my playercontroller and children of my player controller prefab(two cameras, and a mesh renderer)
Here’s the full error:
Trying to send command for object without authority.
UnityEngine.Networking.NetworkBehaviour:SendCommandInternal(NetworkWriter, Int32, String)
PlayerController:CallCmdJoinRedTeam()
UnityEngine.EventSystems.EventSystem:Update()
Here are the voids:
[Command]
public void CmdEnterSpectateMode()
{
PlayerCameraEnabled = false;
PlayerIsVisible = false;
GravityEnabled = false;
PlayerBody = GameObject.Find("PlayerController(Clone)");
PlayerBody.transform.position = new Vector3(500, 30, 675);
}
[Command]
public void CmdJoinRedTeam()
{
PlayerCameraEnabled = true;
PlayerIsVisible = true;
GravityEnabled = true;
PlayerBody = GameObject.Find("PlayerController(Clone)");
PlayerBody.transform.position = new Vector3(617, 10, 500);
PlayerBody.transform.localRotation = Quaternion.Euler(0, -90, 0);
}
[Command]
public void CmdJoinBlueTeam()
{
PlayerCameraEnabled = true;
PlayerIsVisible = true;
GravityEnabled = true;
PlayerBody = GameObject.Find("PlayerController(Clone)");
PlayerBody.transform.position = new Vector3(383, 10, 500);
PlayerBody.transform.localRotation = Quaternion.Euler(0, 90, 0);
}
Does anyone know how I can fix this? Thanks in advance.