Search Unity

Unity Multiplayer BUG: Old SyncList Callback bug was reintroduced to 5.3.3f1

Discussion in 'Connected Games' started by vis2k, Feb 27, 2016.

  1. vis2k

    vis2k

    Joined:
    Sep 4, 2015
    Posts:
    3,445
    There was a UNET bug in an older Unity version where a SyncListStruct callback would be called before the value was changed, which means that our callback function is useless because it can't access the new value, for example:

    Code (CSharp):
    1.  
    2. void Start() {
    3.     equipment.Callback += OnEquipmentChanged;
    4. }
    5.  
    6. void OnEquipmentChanged(SyncListItem.Operation op, int index) {
    7.     print("new list entry: " + equipment[index]); // still shows old entry before change
    8. }
    This bug was fixed a while ago, so that:

    Code (CSharp):
    1. void OnEquipmentChanged(SyncListItem.Operation op, int index) {
    2.     print("new list entry: " + equipment[index]); // shows the new changed entry
    3. }
    I just noticed that the bug exists again. I upgraded to Unity 5.3.3 yesterday, so perhaps it was reintroduced in 5.3.3, considering how the changelog also says something about SyncLists.

    Is this now planned behavior or will this be fixed again in a future version?
     
  2. DRRosen3

    DRRosen3

    Joined:
    Jan 30, 2014
    Posts:
    643
  3. vis2k

    vis2k

    Joined:
    Sep 4, 2015
    Posts:
    3,445
  4. Zullar

    Zullar

    Joined:
    May 21, 2013
    Posts:
    629
    I posted in the other thread but thought I would post here as well to increase visibility and hopefully get the SyncList callback to contain oldVal data.

    In my opinion this isn't as much a SyncList bug as it is a SyncList callback design issue. The SyncList callback does not provide information about the oldVal AND newVal. In many cases you will need access to the oldVal and you don't have this information with SyncLists.

    Compare to SyncVar where you do have access to both oldVal and newVal.
     
unityunity