Synchronize sprite change of players
Options
hello, I am trying to equip a weapon for my character after it is instantiated. (player is instantiated after connecting and joining the room)
In the Start method, I am making an RPC with the weaponId coming from PlayerPrefs for each player.
void Start() { if (view.IsMine) { view.RPC("equipWand", RpcTarget.AllBuffered, PlayerPrefs.GetInt("showWand")); } } [PunRPC] private void equipWand(int id) { if (view.IsMine) { var equippedWand = transform.Find("Pelvis/Torso/ArmR/ForearmR/HandR/MagicWand").gameObject.GetComponent<SpriteRenderer>(); equippedWand.sprite = playerManager.imageData.itemImages[id]; } }
I expect every player to equip their own weapons and make them visible to other player. But currently, they only see their own weapons and nothing for the opponent.
0