Search Unity

SyncListUInt callback has incorrect index

Discussion in 'Multiplayer' started by Pelican_7, Jul 3, 2015.

  1. Pelican_7

    Pelican_7

    Joined:
    Nov 25, 2014
    Posts:
    190
    I'm using a SyncListUInt with a callback to handle when the list is updated like so:

    private void OnSyncListChanged(SyncListUInt.Operation op, int index)

    However, I have found that when receiving this callback with a SyncListUInt.Operation.OP_ADD operation the index is always 0. I was expecting this to give me the index of the add operation.

    Is this a bug or is this expected?

    Thanks,
    Andy
     
  2. Pelican_7

    Pelican_7

    Joined:
    Nov 25, 2014
    Posts:
    190
    I have filed this as a bug (709572).
     
    Last edited: Jul 3, 2015
  3. seanr

    seanr

    Unity Technologies

    Joined:
    Sep 22, 2014
    Posts:
    669
    the Add operation always happens at the end of the list.
     
  4. Pelican_7

    Pelican_7

    Joined:
    Nov 25, 2014
    Posts:
    190
    Ahhh. Great, thanks seanr. I'll check the last item in the event of an OP_ADD.