- Home /
Networking Sync SetActive Not Working
My player character is switching equipped weapons via SetActive(true) and SetActive(false). See the below sample code. This works great in singleplayer.
transform.Find("Aim_Sprite/WS1").gameObject.SetActive(true);
transform.Find("Aim_Sprite/WS2").gameObject.SetActive(false);
transform.Find("Aim_Sprite/WS1").gameObject.SetActive(false);
transform.Find("Aim_Sprite/WS2").gameObject.SetActive(true);
When connecting via LAN, I can't get the active weapon to sync. I've attached a NetworkTransformChild component to the root Player object which points to the WS1 and WS2 objects. The position and rotation of WS1 and WS2 is syncing correctly, but only for the one I have equipped at the start. When I switch weapons on one client, the only still has the original weapon equipped. Am I missing something important here? How do I sync active states across the network?
Your answer
Follow this Question
Related Questions
SyncVar works with disabled components? 0 Answers
[SyncVar] protect Cheat Engine 0 Answers
How fast do Syncvars synchronize? 1 Answer
How to call [Command] on Client in UNet 1 Answer
Multiplayer Moving Bullet 1 Answer