How do you make a SyncList gather data from before the user was connected?
Hello,
I have run into a very confusing problem.
SyncList seem to only sync from the point that a user connects. This means that all data in the list previous to the user connecting, is not synced.
For example.
Player 1 connects first and picks up itemA (which adds an item to the SyncList) Player 2 connects after itemA was picked up. Does not see itemA in the SyncList. Player 1 then picks up itemB. This time player2 see's itemB in the SyncList, but still not itemA.
So my question is, how can I make sure that the contents of a SyncList are downloaded properly when the user first connects?
Here is a little code for those who would like to see it. I am using a SyncListStruct to pass a UniqueID and an itemSlot in the SyncList.
public class Container {
public struct SyncListItemInfo { public SyncListItemInfo(string _sUID, int _itemSlot) { sUID = _sUID; itemSlot = _itemSlot; }
public string sUID;
public int itemSlot;
}
public class SyncListItemInfos : SyncListStruct<SyncListItemInfo>
{
}
[SerializeField]
public SyncListItemInfos ItemInfos = new SyncListItemInfos();
[Server]
public void AddItem(Item item, int itemSlot)
{
ItemInfos.Add(new SyncListItemInfo(item.sUID, itemSlot));
}
}