I have a board that is managed by the server
I couldn’t make SyncList work so i started working with SyncListStruct as it seems better performance wise.
I have these classes -
public struct SquareStruct
{
public int slots;
public int playerNumber;
public int locationX;
public int locationY;
public List<Building> buildings;
}
public class Building
{
public BuildingType building;
public int level;
}
public class SquareList : SyncListStruct<SquareStruct> { }
I have the following SyncVar on a NetworkIdentity:
[SyncVar]
public SquareList squares = new SquareList();
and I populate this list and the clients are updated from it.
works great but - buildings is not syncing to clients - just the host is synced well.
I am aware that inner classes do not make the SyncVar “Dirty” - so after updating a square i do
squares.Dirty(squares.IndexOf(square)).
How can i make it sync to the client? I
I have - private void OnSquaresChanged(SyncList.Operation op, int itemIndex) as the callback to catch changes, the client gets the OnChanged call but the buildings list is null while on the host it’s full.