- Home /
sync renderer.enabled or SetActive() over network?
Hi. I am using renderer.enabled to switch weapons in my multiplayer game. On my computer, i can switch from my red gun to my blue gun, but looking at my player from my friends computer, they don't change... What method should i use to sync renderer.enabled or gameObject.SetActive over the network? I do have a NetworkView attached to my player...
Comment
Best Answer
Answer by Dreamora · Jan 02, 2013 at 08:54 AM
Use a simple RPC like
[RPC]
void EnableWeapon(int weapon) {
weapons[currentWeapon].SetActive(false);
weapons[weapon].SetActive(true);
currentWeapon = weapon;
}
and just call it through the networkView.RPC("EnableWeapon",newWeaponIndex) for example
Your answer
Follow this Question
Related Questions
sync renderer.enabled or SetActive() over network? 0 Answers
Does .SetActive work with components? 1 Answer
Sync Network Animation State 2 Answers