- Home /
Question by
KaidaStudios · Sep 11, 2017 at 03:14 AM ·
unity 5networkingvariablenetwork.instantiatenetworkplayer
UNET Client wont update varsync
Same stuff I have been seeing everywhere but no solutions have worked. The host works perfectly, the client does not work. The hooks are being called with no data sent. Except it still does not update within the server. I'm not sure what to do anymore.
[SyncVar(hook = "Rpcchangehelm")]
public int ehelm;
[Command]
public void Cmdchangehelm(int num)
{
this.ehelm = num;
}
[ClientRpc]
public void Rpcchangehelm(int num) {
ehelm = num;
if (body.male)
{
if (HelmName == HelmName)
{
Destroy(HelmInst);
}
HelmName = Helm[num].name;
GameObject NewHelm = (GameObject)Instantiate(Resources.Load("Armor/" + HelmName));
HelmInst = NewHelm;
Destroy(NewHelm);
AddHelm();
}
}
The code that calls the command is on a UI function ASSIGN:
if (itemInfo.EquipType == UIEquipmentType.Head && !equipped)
{
transform.root.SendMessage("Cmdchangehelm", itemInfo.ID);
Player.SendMessage("addarmor", itemInfo.Armor);
Player.SendMessage("addstrength", itemInfo.Strength);
print(itemInfo.ID);
StartCoroutine(equipitem());
}
Comment
Your answer
Follow this Question
Related Questions
This is giving an error for the other client and cannot hit other client. 1 Answer
Why Does Adding to My SyncListStruct Break SyncVar? 0 Answers
Network messages (OnPlayerConnected, OnServerInitialized) never gets called 0 Answers
I want to set play scene of network lobby manger through script 0 Answers