I'll show you the method I used to save my inventory to a file and then reload the inventory from the file.
Discord for Support: [ Ссылка ]
I'm using Visual Studio 2019 and Unity 2019.3 but the version doesn't matter very much for this tutorial - you could use older or newer versions of Unity to accomplish the same objectives.
This system is built on my Simple Inventory package which you can get for free on GitHub. You can also use this system with your inventory, assuming you store your inventory as a Dictionary.
This does not use the Unity built-in PlayerPrefs method (hack) and it doesn't use the JSON Utility built into the UnityEngine namespace.
This will create a very simple save file in your Application's data path. Because of its simplicity, the file is easy to modify so it would be easy for your players to cheat. That is the tradeoff of using this system over another one (that might be more complicated).
Total lines of code (including white space) on the Save class is 87.
GitHub Code: [ Ссылка ] (You'll need the project - or you can manually bring in the SampleScene, Inventory, SaveInventory class, ThirdPersonMovement, Follow (camera)).
I recorded this on Active Presenter.
The Floppy Disk in the thumbnail was a free png from FlatIcon.com FreePik's Essentials pack.
Ещё видео!