- Home /
Saving a scriptable object to the "Assets" folder, and creating a folder for it to go into.
Wondering how to do this, I'm generating a scriptable object at runtime and I need to save it to a folder inside of "Assets"
Answer by SolidAlloy · Sep 02, 2020 at 05:12 PM
To create a folder, use AssetDatabase.CreateFolder:
AssetDatabase.CreateFolder("Assets", "CustomFolder");
Saving a scriptable object to the folder is also easy:
AssetDatabase.CreateAsset(yourScriptableObject, "Assets/CustomFolder/NewScriptableObject.asset");
AssetDatabase.SaveAssets();
You can read more about the mentioned methods at the following links: https://docs.unity3d.com/ScriptReference/AssetDatabase.CreateAsset.html https://docs.unity3d.com/ScriptReference/AssetDatabase.SaveAssets.html
Answer by Da_Elf · Mar 23, 2021 at 04:12 PM
This is insanely easy to understand and exactly what i needed after searching for two days.
Your answer
Follow this Question
Related Questions
Initialising List array for use in a custom Editor 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Repaint EditorSettings inspector from custom menu item 1 Answer
Script Editors for Unity 3 Answers