Pro Only: Weaver Lite allows you to try out asset lists in the Unity Editor, but they will always be empty in a runtime build unless you purchase Weaver Pro.
Sometimes it is useful to generate an unknown number of Procedural Assets. For example, you might want to set up a spreadsheet containing the stats of every enemy in your game so you can easily analyse and work with them in a program such as Microsoft Excel before turning them into prefabs in Unity.
Defining a procedural Asset List works much like defining any other Procedural Asset, except that:
- The field can be any type derived from
AssetListBase
. - The method can return any type that implements the
IEnumerable<T>
interface, whereT
inherits fromUnityEngine.Object
(includingT[]
orList<T>
). Note that the chosen return type has no impact on the way the assets are accessed at runtime (see below). - Then the list can be generated like any other Procedural Asset.
Internal Process
Weaver executes the following process to generate a Procedural Asset List:
- Create a new temporary scene so that the current scene isn’t inadvertently modified.
- All procedural asset lists use
AssetListGenerator
which chooses the most appropriate Asset Generator to use for each item based on its type. - Invoke the generator method and save each item in the returned collection in the list's target
Directory
using each item's name as its file name. - If any assets generated last time were not overwritten this time, delete them.
- Close the temporary scene and return to the original scene setup.