Type:SyncRefDictionary
More actions
A SyncRefDictionary is a type of Collection that maps data model values (string, int, float, etc) to data model references (Slot, IWorldElement, etc). Every key in a dictionary is unique and maps to a specific value, which doesn't have to be unique. For string and Uri, null may be used as a key. For Nullable types, null may not be used as a key.
If you are looking to map data model values to data model values, see SyncFieldDictionary. There is currently no way to use data model references as keys in a dictionary.
SyncRefDictionaries are synchronized between all players in a session, and their contents persist across duplicating and saving, like other fields. The contents of any SyncRefDictionary cannot be viewed or edited using an inspector at this time, which is why an inspector on one says "Dictionaries not supported yet". This is misleading, as dictionaries may be read and edited with the use of specific nodes, see Collections for a list of all the nodes which can work with collections.
A SyncRefDictionary may be placed on a slot via attaching a ReferenceDictionary component to it and providing the appropriate types. From there, the SyncRefDictionary on that component may be referenced statically like any other reference, or exposed via a Dynamic variable matching the dictionary's exact type.