SyncHashset
//Creates a new instance of the Hashset - `true` means it is owner auth.
[SerializeField] private SyncHashSet<string> myHashSet = new(true);
protected override void OnSpawned()
{
//Subscribing to changes made to the hash set
myHashSet.onChanged += OnHashSetChanged;
}
private void OnHashSetChanged(SyncHashSetChange<string> change)
{
//This is called for everyone when the hash set changes.
//It will log out the Value and operation
Debug.Log($"HashSet updated: {change}");
}
Last updated