Unet disable button from client
Hi, I'm new with unet and want to set button.interactable = false on a button for all the clients when on player clicks another button.
To make it a little less confusing. I have 2 buttons on the ui. I want that when one player clicks one of those buttons, the other one cannot be clicked by anyone.
Thanks!!
Answer by jloffredo · Dec 02, 2015 at 02:45 PM
Finally got to solve this issue. I was trying to call the Cmd and RPC from the button. I added the scripts to the player object and used AssignClientAuthority on the button.
Now it works.
Answer by Wolfrik_Creations · Nov 29, 2015 at 01:59 AM
Here ya go!
if(Network.isServer) {
//PUT YOUR SERVER ONLY BUTTON HERE
}else{
//PUT YOUR CLIENT ONLY BUTTON HERE
}
Thanks, but how/where do I put that code so that the button is disabled to all the players? As far as I understand it should be done with a command, but I get this error: "Trying to send command for object without authority." If I put network Identity component on the button the players don't see it, only the server.
Your answer
