- Home /
Second Clients canvas won't register clicks?
Obligatory "i'm very new". I couldn't figure out how to hook up a canvas that the player interacts with (chooses which team they'll be playing on in the game) that I had would work out if it was in the scene that the player prefab would be spawned into. So I put the canvas into the prefab with the player and set it as inactive once they select which team.
It works flawlessly for the host but when the second client joins their canvas is there, but won't take any input. I know it's this because the debug.log i put in right after input is not being run. here are the code segments that are necessary.
The following is run on a script attached to the canvas (of which the empty player object is the parent of)
Button CT = chooseCT.GetComponent<Button>();
CT.onClick.AddListener(parent.GetComponent<Sync>().CmdpickedCT);
and this is the code that runs on a script on the parent object
[Command]
public void CmdpickedCT()
{
GetComponent<Movement>().playerTeam = 2;
teamSelector.SetActive(false);
}
I apologize if I'm missing something big here. Thanks for any help.
for more information i have more stuff in the movement script run once the playerTeam is set to something other than 0, this also works on the host. Any other information you can give about how to pass info from the objects in the game scene to the instantiated objects would be great too. Thanks again.
Additional information, it seems like if i have both the second client and first client on the canvas at the same time, I cannot choose my team with either. It says "Trying to send command for object without authority".
Your answer
Follow this Question
Related Questions
Unity networking tutorial? 6 Answers
How to write a multiplayer game that uses a dedicated server? 0 Answers
Questions about Multiplayer and Networking? 1 Answer
OnStart ___ vs OnLobbyStart ___ methods from NetworkManager and NetworkLobbyManager 1 Answer
Netcode - client can't move his player.,Unity netcode movement not working on clients 1 Answer