Read Write ScriptableObject in ProjectSettings Folder.

I need read/write ScriptableObject in ProjectSettings Folder to save my editor extension’s per-project settings like unity official project settings did.

I’ve tried :

settings = ScriptableObject.CreateInstance<MyPlugin>();
AssetDatabase.LoadAssetAtPath<MyPlugin>("ProjectSettings/MyPlugin.asset");
AssetDatabase.CreateAsset(settings, "ProjectSettings/MyPlugin.asset"); 

AssetDatabase.LoadAssetAtPath<MyPlugin>("<OtherFolder>/MyPlugin.asset");
AssetDatabase.CreateAsset(settings, "<OtherFolder>/MyPlugin.asset"); 

It doesn’t work with error:
UnityEngine.UnityException: Creating asset at path ProjectSettings/MyPlugin.asset failed.
at (wrapper managed-to-native) UnityEditor.AssetDatabase:CreateAsset (UnityEngine.Object,string)
at MyPlugin…cctor () [0x00033] in …
UnityEditor.EditorAssemblies:SetLoadedEditorAssemblies(Assembly)

It seems that all apis in AssetDatabase can only read / write “Assets” folder. If so, why keep "Assets" in Path? If not so, how to read write folder in project folder other than “Assets” folder?

Please help. Thanks.

Yes unfortunately those API points only work with files in the Assets folder, though I can’t comment as to why they therefore still require specification of the Assets folder in the supplied path.

If you want to read/write files in the Project Settings folder, I would suggest you consider .NET standard file I/O in combination with Unity’s JsonUtility. That said, you’d have to do some engineering if you need to detect external changes to the file and so on.