AssetListBase Class

Summary

A UnityEngine.ScriptableObject containing a list which is automatically populated with all assets of a given type in a specific folder. Gathering takes place in the Unity Editor so the list can be loaded efficiently at runtime and the target assets do not need to be in a Resources folder.
Assembly
Weaver.dll
Namespace
Weaver
Interfaces
  • WeaverWindow.IItem
Base Types
  • ScriptableObject
Derived Types
graph BT Type-->Base0["ScriptableObject"] Type-.->Interface0["WeaverWindow.IItem"] Type["AssetListBase"] class Type type-node Derived0["AssetList"]-->Type click Derived0 "/weaver/api/Weaver/AssetList"

Syntax

public abstract class AssetListBase : ScriptableObject, WeaverWindow.IItem

Remarks

Unfortunately, Editor-Only fields (such as the target Weaver.AssetListBase.Directory and Weaver.AssetListBase.Recursive flag) can't be declared in a pre-compiled assembly or generic type. This complicates the structure of Weaver's source code since Weaver.AssetListBase needs to be inside Weaver.dll to integrate with other systems while the other classes (AssetList, AssetList<T>, LazyAssetList<T>, and MetaAssetList<TAsset, TMeta>) need to be out in the Unity project for Unity to compile them itself.

Properties

Name Value Summary
AssetType Type
The type of assets in this list.
Count int
The number of assets in this list.
Directory DefaultAsset
[Editor-Only] The directory from which this list will gather assets.
IsLazy bool
If true: this list will only load its assets as they are needed rather than on startup.
MetaDataType Type
The type of meta data in this list.
Recursive bool
[Editor-Only] If true: this list will gather assets in any sub-directories as well as the target directory.
Tooltip string
[Editor-Only] The text to use to describe this list when showing a tooltip in the Weaver.Editor.Window.WeaverWindow.

Methods

Name Value Summary
Clear() void
Clears all the assets from this list.
DoDetailsGUI() void
[Editor-Only] Draws the details of this list in the inspector.
GatherAssets() void
[Editor-Only] Override to gather the assets in the target Weaver.AssetListBase.Directory.
GatherAssets<T>(List<T>) void
[Editor-Only] Gathers all assets in the target Weaver.AssetListBase.Directory into the `assets` list.
GatherAssets<T>(List<T>, string, bool) void
[Editor-Only] Gathers all assets in the target Weaver.AssetListBase.Directory into the `assets` list.
static
GatherAssetsIfDirty() void
[Editor-Only] Gathers the assets in the target Weaver.AssetListBase.Directory if they might have changed since this method was last called.
GatherResources<T>(List<string>, List<T>) void
[Editor-Only] Gathers all assets and their resource paths in the target Weaver.AssetListBase.Directory.
GetAndVerifyDirectoryPath() string
[Editor-Only] Returns the path of the target Weaver.AssetListBase.Directory relative to the project root or null if a valid folder isn't assigned.
GetRandomIndex() int
Returns a random index in this list.
OnDisable() void
[Editor-Only] Called by Unity when this list is unloaded. Ensures that all assets in the target Weaver.AssetListBase.Directory are gathered so they can be serialized.
OnEnable() void
[Editor-Only] Ensures that this list is in the global collection of all lists so it can be displayed in the Weaver Window and can show project window overlays on its target assets.
Reset() void
[Editor-Only] Assigns the currently selected object as the Weaver.AssetListBase.Directory if possible.
SetListTypes(Type, Type, Type) void
[Editor-Only] Assigns the list types that need to be defined outside this assembly so they c an be used internally.
static