Skip to main content

Value Lists

ValueLists are the go-to collection type in Unity Atoms. You can think of it as a AtomVariable<List<T>>.

A common use case is storing a list of Enemies for easy access.

Creating an Enemy Prefab

  1. Adding a Cube to the Scene and creating a prefab out of. I named it "AngryCube".
  1. Now add a Sync GameObjectToList component to the prefab. This will automatically add instances of the prefab onto the list on Start (and removes them OnDestroy)
  2. Press the [Create] Button on the Sync GameObjectToList component to create a new ValueList asset, we name it "ListOfEnemyGameObjects".
  1. In play mode, we can now observe the ValueList asset and see how gameobjects are added to it on start and removed when leaving the play mode.