I am working on such a simple thing as having a UI button that sends a command to print in a multiplayer (UNET) environment. Given what i have done so far i thought this would be easy but i am totally stucked and confused.
I have created a new project, to test, but I am still not able to get this to work. I am able to spawn and trigger the button's onClick i still get "Trying to send command for object without authority". I have the Canvas & button as a prefab and I have attached the script, below to the Canvas prefab and then the canvas to the button OnClick property.
using UnityEngine;
using UnityEngine.Networking;
using System.Collections;
public class NM_Script : NetworkBehaviour {
public void DoButton() {
Cmd_Print ();
}
[Command]
void Cmd_Print() {
print ("HIT");
}
}
After all the different testing i am at a point that i "probably" do not see the forrest because of the trees and I am getting quite frustrated. I know the solution is simple and obvious and that i should be able to solve it but....
I would really appreciate if someone could help me to solve this once for all.