Search Unity

How do you sync sprite changes across the network in unity?

Discussion in 'Multiplayer' started by SoliderSpy, Mar 22, 2018.

  1. SoliderSpy

    SoliderSpy

    Joined:
    Nov 30, 2016
    Posts:
    3
    Anyone know how to sync sprite changes on an object across the network in a unity game?

    I have an array of sprites and when the object's sprite changes to one of the sprites in the array, it does not register on the client but only on the host.

    [SyncVar] or [SyncList] (for arrays) usually does this but it doesn't work on sprites because....

    "Cannot apply attribute class 'SyncList<T>' because it is generic"

    https://gyazo.com/49175f3c78bf8dc2e0aaee39347b8349

    Thanks!
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Are you trying to sync the references to the sprites or just an index number of what sprite to use? I don't think SyncList works with most reference types.
     
  3. SoliderSpy

    SoliderSpy

    Joined:
    Nov 30, 2016
    Posts:
    3
    I want to sync the index number. I assume this will allow the sprite of the object to change on the client and server?