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”

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:

This is insanely easy to understand and exactly what i needed after searching for two days.