Question by
petrbnv · Feb 18, 2019 at 06:46 PM ·
gameobjectnetworkinggamerpccommand
networking one Command works, and one doesn´t
Hi guys, I´m having a problem trying to figure out, how does the networking work, and why doesn´t the first part work, but the second one does.
Thanks for you help . Here´s my code:
first part(not working):
void select(){
foreach (GameObject unit in units){
Cmdselect(unit, true);
}
}
[Command]
void Cmdselect(GameObject unit, bool x){
unit.GetComponent<UnitMovement>().RpcSetSelected(x);
}
VS Second Part(working):
void select(){
Cmdselect(true);
}
[Command]
void Cmdselect(bool x) {
foreach (GameObject unit in units){
unit.GetComponent<UnitMovement>().RpcSetSelected(x);
}
}
"units" is a static list of GameObjects the first part doesnt work, the second one does, why ?
Thanks for you help .
Comment
Your answer
Follow this Question
Related Questions
UNET: Network [Command] from non-player object 0 Answers
Instantiating over the Network, good way? 1 Answer
Networking functions work fine on player object, but not other objects 0 Answers
ClientRPC not called from command on client instance during Start() 0 Answers
[Command] Not being called at all 0 Answers