Syncing SpriteRenderer’s Sprite Over Network

Updated on October 23, 2017 in [A] Multiplayer
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
1 on October 22, 2017

I have a simple multiplayer game made with c# in unity,

the problem is that I want to sync a sprite that constantly changes over the network

part of my code:

public class ClothChanger : NetworkBehviour
{
public Sprite[] clothes;
[SyncVar] public int clothIndex;
public void Update()
{
GetComponent<SpriteRenderer>().sprite = clothes[clothIndex];
}
}
  • Liked by
Reply
0 on October 23, 2017

bump…

  • Liked by
Reply
Cancel