#Referencing ScriptableObjects in Assets

1 messages · Page 1 of 1 (latest)

orchid sand
#

So I am currently making a selection system and I want to be able to assign ScriptableObjects to my script.
I could just make a list of every ScriptableObject and assign them in the editor, but I don't like this approach as it's not very flexible for if I want to add more items.
I also briefly looked into loading from assets. I like this way more but I am unsure if it's a good/the best way and I'm not sure how to do this if I were to.

peak elk
#

My go to approach to do this is to create a new ScriptableObject type as container which just has a list of the ScriptableObject type I actually want. Then assign that container instance in the editor.
You can then update that list manually or build some tooling to update it automatically. Can even update it as a custom build step so you can be sure you never ship an old list.
Resources.LoadAll should also be able to do this though. I just never really liked the Resources functionality.

orchid sand
orchid sand