Search Issue Tracker

Fixed in 5.3.0

Votes

1

Found in

5.2.1p3

Issue ID

736703

Regression

Yes

[UNET] SyncList passes wrong itemIndex to callback method when the operation is OP_ADD

Networking

-

Reproduction steps:
1. Open attached project
2. Open and play the "offline" scene
3. Start host (the "LAN Host (H)" button)
4. Observe console, the itemIndex is 1 when the operation is OP_ADD.

Expected result: The itemIndex should be 0 when the operation is OP_ADD.

Note: With other operations such as OP_SET, the itemIndex is 0.

Regression from first not working version: 5.2.0f1 (89160207ce1a)

Comments (2)

  1. RikuTheFuffs

    Jul 18, 2017 12:06

    Looks like it appeared again on 5.5.4p3, same thing for the OP_REMOVE. Using OP_REMOVEAT works as a workaround

  2. ekleban

    Feb 09, 2016 16:43

    I have the same issue with OP_UPDATE. See the code inside the networking dll below.
    Unity passes itemIndex=0 as it was written at the server side.
    I have no way to know what item was removed at the client side!
    Moreover, if I knew the index, it would already be removed from the list!
    Thanks.

    server:

    this.SendMsg(SyncList<T>.Operation.OP_REMOVE, 0, item);
    ...
    writer.WritePackedUInt32((uint) itemIndex);

    client:

    int index = (int) reader.ReadPackedUInt32();
    T obj = this.DeserializeItem(reader);
    ...
    this.m_Objects.Remove(obj);
    ...
    this.m_Callback((SyncList<T>.Operation) num, index);

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.