|
1 |
| -com.gameframe.saveload |
| 1 | +<h1 align="center">Welcome to com.gameframe.saveload 👋</h1> |
| 2 | +<p> |
| 3 | + <img alt="Version" src="https://img.shields.io/badge/version-1.0.0-blue.svg?cacheSeconds=2592000" /> |
| 4 | + <a href="https://twitter.com/coryleach"> |
| 5 | + <img alt="Twitter: coryleach" src="https://img.shields.io/twitter/follow/coryleach.svg?style=social" target="_blank" /> |
| 6 | + </a> |
| 7 | +</p> |
2 | 8 |
|
| 9 | +> This is a simple utility for quickly saving and loading objects to disk in unity.</br></br> |
| 10 | +> Supports Binary, UnityJson, and JsonDotNet.</br> |
| 11 | +> Optionally you can select an encrypted version of each of the above.</br> |
| 12 | +> Additionally custom serialization methods are supported using the ISerializationMethod interface.</br> |
| 13 | +> JsonDotNet support requires the Json.Net for Unity asset store package or Newtonsoft's Json.</br> |
| 14 | +> For info on enabling JsonDotNet support see the <b>Enable Json.Net Support</b> section of this readme.</br> |
| 15 | +
|
| 16 | +## Quick Package Install |
| 17 | + |
| 18 | +#### Using UnityPackageManager (for Unity 2019.1 or later) |
| 19 | + |
| 20 | +Find the manifest.json file in the Packages folder of your project and edit it to look like this: |
| 21 | +```js |
| 22 | +{ |
| 23 | + "dependencies": { |
| 24 | + "com.gameframe.saveload": "https://github.com/coryleach/UnitySaveLoad.git#1.0.0", |
| 25 | + ... |
| 26 | + }, |
| 27 | +} |
| 28 | +``` |
| 29 | + |
| 30 | +## Usage |
| 31 | + |
| 32 | +SaveLoadManager supports multiple instances.<br /> |
| 33 | +In the project tab menu select Create->Gameframe->SaveLoad->SaveLoadManager<br /> |
| 34 | +This will create an instance of a SaveLoadManager asset.<br /> |
| 35 | +Select the created object and configure options via the inspector.<br /> |
| 36 | + |
| 37 | +```C# |
| 38 | +//Save to disk |
| 39 | +manager.Save("MySave.data",objectToBeSaved); |
| 40 | + |
| 41 | +//Load from disk |
| 42 | +var loadedObject = manager.Load<SavedObjectType>("MySave.data"); |
| 43 | + |
| 44 | +//Delete |
| 45 | +manager.DeleteSave("MySave.data"); |
| 46 | + |
| 47 | +//Create Manager at Runtime |
| 48 | +manager = SaveLoadManager.Create("BaseDirectory","SaveDirectory",SerializationMethod.Default); |
| 49 | + |
| 50 | +//Setup a Custom Save/Load Method by passing any object that implements ISerializationMethod |
| 51 | +manager.SetCustomSerializationMethod(new MyCustomMethod()); |
| 52 | +``` |
| 53 | + |
| 54 | +## Enable Json.Net Support |
| 55 | + |
| 56 | +Ensure the Json.Net for Unity package has been imported. |
| 57 | +In player settings add the string 'JSON_DOT_NET' to Scripting Define Symbols. |
| 58 | + |
| 59 | +## Author |
| 60 | + |
| 61 | +👤 **Cory Leach** |
| 62 | + |
| 63 | +* Twitter: [@coryleach](https://twitter.com/coryleach) |
| 64 | +* Github: [@coryleach](https://github.com/coryleach) |
| 65 | + |
| 66 | +## Show your support |
| 67 | + |
| 68 | +Give a ⭐️ if this project helped you! |
| 69 | + |
| 70 | +*** |
| 71 | +_This README was generated with ❤️ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_ |
0 commit comments