#Loading and Accessing ScriptableObject instances without Inspector

1 messages · Page 1 of 1 (latest)

slim parcel
#

Hi, sorry if this is a weird question, but does anyone know of a way to either directly access ScriptableObject assets at editor time (i.e., not through an inspector-set field), or to force all ScriptableObject instances to be created when Unity loads? I'm trying to create an editor that needs a list of all ScriptableObject instances of a given type, but I've found that in editor mode, Unity only creates those instances as-needed.

#

The way I've been doing it thus far was to have the instances register themselves in a static list on instantiation, but the list can be referenced before all of the instances have been created and registered.

buoyant mason
slim parcel
#

I can send the relevant code

buoyant mason
#

Are you trying to get he list for runtime use or for use in the editor?

slim parcel
#

use in editor

buoyant mason
#

You want to use the first method I mentioned then

#

You can google something like "Unity editor how to find all assets of type" and it should give you what you need

slim parcel
#

ah, so i suppose then i would use this in conjunction with AssetDatabase.LoadAssetAtPath

#

or wait

buoyant mason
slim parcel
#

gotcha

buoyant mason
#

(or whatever the method is called, I can't remember exactly)

slim parcel
#

a lil roundabout but it seems reasonable

#

i suppose my use-case isn't a particularly common one

buoyant mason
#

It isn't that uncommon either

slim parcel
#

oh huh

buoyant mason
#

I've done it multiple times

slim parcel
#

i'll try this out then