Runtime writing should only be under Application.persistentDataPath
If you have something in Assets, you need to read it out and write it to the above location at runtime.
You should avoid making a pre-made save file, unless it’s appropriate to your game in the sense of “here’s my game, and here’s a pre-made save game to get you started.” If you do that, put the pre-made stuff in StreamingAssets and Unity will not touch it at all and you can read it in the build. See docs for how.
Well that’s just JSON… and here’s my blurb on that:
Problems with Unity “tiny lite” built-in JSON:
In general I highly suggest staying away from Unity’s JSON “tiny lite” package. It’s really not very capable at all and will silently fail on very common data structures, such as bare arrays, tuples, Dictionaries and Hashes and ALL properties.
Instead grab Newtonsoft JSON .NET from the Unity Package Manager (Window → Package Manager).
If you want to avoid the Package Mangler’s UI, just add this to your Packages/manifest.json file:
"com.unity.nuget.newtonsoft-json": "3.0.2",
https://assetstore.unity.com/packages/tools/input-management/json-net-for-unity-11347
Also, always be sure to leverage sites like:
https://jsonlint.com
https://json2csharp.com
https://csharp2json.io
Finally I leave you with another carpet bomb of useful links regarding loading / saving, as it is both an extremely well-traveled area of game development, as well as one that has a lot of technical, spatial and temporal traps you can fall into when implementing it.
Load/Save steps:
https://discussions.unity.com/t/799896/4
An excellent discussion of loading/saving in Unity3D by Xarbrough:
https://discussions.unity.com/t/870022/6
Loading/Saving ScriptableObjects by a proxy identifier such as name:
https://discussions.unity.com/t/892140/8
When loading, you can never re-create a MonoBehaviour or ScriptableObject instance directly from JSON. The reason is they are hybrid C# and native engine objects, and when the JSON package calls new to make one, it cannot make the native engine portion of the object.
Instead you must first create the MonoBehaviour using AddComponent() on a GameObject instance, or use ScriptableObject.CreateInstance() to make your SO, then use the appropriate JSON “populate object” call to fill in its public fields.
If you want to use PlayerPrefs to save your game, it’s always better to use a JSON-based wrapper such as this one I forked from a fellow named Brett M Johnson on github:
https://gist.github.com/kurtdekker/7db0500da01c3eb2a7ac8040198ce7f6
Do not use the binary formatter/serializer: it is insecure, it cannot be made secure, and it makes debugging very difficult, plus it actually will NOT prevent people from modifying your save data on their computers.
https://docs.microsoft.com/en-us/dotnet/standard/serialization/binaryformatter-security-guide