Hello I have a problem with SyncListStructs I have this code:
public struct player_struct {
public string name;
public string ID;
public int Kills;
public int Deaths;
public int Points;
public bool ready;
public int Team;
public player_struct(string n, string i, int t) {
name = n;
ID = i;
Kills = 0;
Points = 0;
Deaths = 0;
ready = false;
Team = t;
}
}
public class SyncListPlayer : SyncListStruct<player_struct> { }
public SyncListPlayer list_players = new SyncListPlayer();
public override void OnStartClient() {
list_players.Callback = list_changed;
}
public void list_changed(SyncListPlayer.Operation op, int index) {
print("Something has changed in list");
}
There is no problem in the host side when I add a new player_struct with commands it prints “Something has changed in list” but in the client side I get a null pointer exception on assigning the callback (list_players.Callback = list_changed;).
This is the exception:
So there is no synchronization , I tried with SyncListString and it worked perfect, so I don’t know what is happening with the SyncListStruct.
I need help because I really need this to work to get the score on the game.