I have an empty GameObject with scripts, i added networkIdentity to it.
I haves UI button on the scene that triggers “Btn_Button ()”.
I get the “Trying to send command for object without authority”, line 16, when i click button on client. I just do not get this work and would like to get some help from someone nice.
This is the script:
using UnityEngine;
using UnityEngine.Networking;
using System.Collections;
using UnityEngine.UI;
public class UI_Menu1 : NetworkBehaviour {
public Animator anim_Menu;
public Button btn_OpenMenu;
private bool yourBool = false;
[SyncVar(hook = "UI_DoMenu")] private bool _myBool = false;
void UI_DoMenu(bool value) {
Cmd_Print ();
}
public void Btn_Button () {
if (yourBool) {
yourBool = false;
} else {
yourBool = true;
}
_myBool = yourBool;
}
[Command]
void Cmd_Print() {
print ("HIT");
}
}