To find active ScriptableObjects during runtime, you can use Resources.FindObjectsOfTypeAll()
.
T[] instances = Resources.FindObjectsOfTypeAll<T>();
Where T
is the type of the ScriptableObject instance you're searching. Active means it has been loaded in memory in some form before.
This method is very slow so remember to cache the return value and avoid calling it frequently. Referencing the ScriptableObjects directly in your scripts should be your preferred option.
Tip: You can maintain your own instance collections for faster lookups. Have your ScriptableObjects register themselves to a shared collection during
OnEnable()
.