Hi! I’ve been trying to do this with Resources.Load<>();
but to no avail. this is my ScriptableObject.
[CreateAssetMenu(fileName = "New Move", menuName = "Move")] public class Move : ScriptableObject { public enum Type{Water, Fire, Ice, Light, Dark, Kami}; public bool isDamaging; public bool isUsable = true; public int dmg; public int reloadTime; public GameObject spawn; public Type type; }
I’m not very experienced with scripting, I’m rather a beginner, so some help would be appreciated.
How can I search for a specific instance of it sitting in the editor in my Assets folder through script?
Resources.Load<>() it’s the correct method. Just remember that the Resources class only loads stuff from a folder in your project called Resources. This is stated in the documentation for Resources.Load. From that point you only need to provide the correct path for the scriptable object.
For example, if the file is just under Resources and it is called FireMove
Move move = Resources.Load<Move>("FireMove");
If the file is under a folder called Scriptables inside Resources
Move move = Resources.Load<Move>("Scriptables/FireMove");
This should do what you want.
As a side note, you should probably take a look at Asset Bundles. These are what you should ideally be using for loading assets at run time. It’s a bit more complicated but it is the preferred way to do it since it provides a lot more flexibility. Resources is an easy and fast way to load something but if you want to do anything serious with it, it won’t hold up that well. Anyway, maybe for your project Resources is enough but that is up to you.