Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Collections

From Resonite Wiki
(Redirected from Collection)
While very powerful even in it's current state, full collection support is as yet unfinished. Read below for limitations and future plans.

'Collections' is C#'s name for all types of arrays, such as lists, dictionaries and bags. Because Resonite is written in this language a lot of the available types are based on this core. Along with the generic, Resonite also exposes a number of of higher level types as well for dealing with more specialized applications, such as 'Hits' from RaycastAll. The ProtoFlux Collections Category can be useful for building with such collections.

These have existed behind the scenes from the first days of FrooxEngine but previously were only accessible using mods. As of 2026.8.26.1047('Collections Part 1') they have become accessible in ProtoFlux.

Limitations

The current biggest limitation is the ability to create/allocate new collections in the network synced data model store directly using ProtoFlux. You can use a write to create a local/store for use within the ProtoFlux execution context however. You can also use some types of Components to 'pre-allocate' Collections: See #Usage for some workarounds until the official implementation is completed.

Inspector collection editing still largely unimplemented.

A number of types are not yet accessible/exposed, these include:

  • SyncDictionary(GH #7025) - SyncRefDictionary however do.
  • Structs
  • Classes(Components) (GH #7055)

Types

While words like 'Value' is used, it should be reminded that Value can be and often are Objects/Refrences, not simple numbers.

List

Often known as just arrays in other languages, These are represented as a list(ha!) of values of any data type that can accessed by an index.

They are accessed by their location in the list. Typically an Int using nodes such as GetAt.

Index Value
1 Dragons
2 Kobolds
3 Lizards
4 Rocks
5 Moss

Dictionary

These are represented as set of key/value pairs. While the value can be anything, all the keys must be unique.

If you know the Key, you can get the resulting value, using GetKey. Or you can iterate over the whole table one pair at a time with nodes such as ForEach.

Key Value
Frooxius Yellow
Decoy Purple
Nexulan Green

Bag

Bags are a list of items of any generic type with no inherent order. It can have duplicates too. They are typically a collection of objects, such as a list of users (and related details) in ValueUserOverride, or found on any slot's component list in the inspector using the WorkerBag (which was used in the early days of Ref Hacking).

Usage

To plain store a collection in the datamodel, you can use these components:

Other components also contain accessible collections. The following pages have lists of collections that can be accessed: (Wiki login requried)

Useful pages on the Wiki

Notes

Needs a table of what data types can be used with what kind of arrays, etc.. What can be used with what types and how.

for int?

Lists vs arrays? ValueArray<T> and a ValueList<T>? (Arrays have fixed lengths. Lists can be added to.)

ProtoFlux Data Type Extensable Component
ValueArray Value No
SyncFieldList Value Yes ValueList
FieldList

Searching for node Types

This can be one of the most frustrating aspects to using Collections. For most cases finding the correct type of node and connecting it to the source will make it Overload and change to the correct type. However in some cases you need to be able to manually search for the correct node types (also referred to as Complex Types).

AddValueWithObjectKey:

  • AddValueWithObjectKey (used when the "dictionary value" is a protoflux value type, in this case "float" is, and "dictionary key" is a protoflux object type, in this case "string" is)
  • AddObjectWithObjectKey (for example IDictionary<string,string>)
  • AddObjectWithValueKey (for example IDictionary<int, string>)
  • AddValueWithValueKey (for example IDictionary<float, float>)

In the example to the left, hovering the FluxTool over the desired node output gives the following string: Dictionary <SyncRefDictionary<BodyNode,Slot>

From this we can work out it's a Dictionary thus needs to use the GetKey node to access it (Instead of for example GetAt for a List ). The first name is the name of the 'Key' that is used as the Key/Value pair of the Dictionary and the second is the Value that is being stored and will be the final output from the resulting node.

BodyNode is an Enum, so is a Value. And A slot is an Object so:

Under Collections -> GetKey choose, in this case: GetObjectWithValueKey

  • In TDictionary: SyncRefDictionary<BodyNode,Slot>
    • This needs to be the full name of the desired Collection.
  • In TKey: BodyNode
  • in TValue: Slot

This gives the final Node: GetObjectWithValueKey<SyncRefDictionary<BodyNode,Slot>,BodyNode,Slot>

History

  • 2026.8.26.1047 (See: discord link for full notes)
    • Lists and Dictionary type collections are now supported!
    • ForEach, ForEachWithIndex, AsyncForEach & AsyncForEachWithIndex
    • Add, Contains (element/key), GetA (index/key), Set (index/key) IndexOf, InsertAt, Remove (element/key), RemoveAt, Count, Clear, IsReadOnly, UnpackKeyValuePair
    • SplitString/JoinString - Works with collections of strings.
    • Users/RaycastAll - New nodes that directly create collections as outputs.
    • EnumValues - to get a Read Only collection of Enum types.
  • 2026.8.27.1059 (See: discord link for full notes)
    • ValueList/ValueArray/ValueDictionary/ReferenceDictionary components for storing collections
    • ForEachWithIndex now works with ReadOnly
    • RemoveAll nodes, which will remove all occurences of specific value in a list

See Also

Videos

Introductory Tutorial for Getting Started with Collections

Dictionary Specific Tutorial