Skip to content

Commit d04ec21

Browse files
authored
Merge pull request #1 from coryleach/dev
Merge 1.0.2
2 parents cdbb941 + bebadb5 commit d04ec21

12 files changed

+42
-53
lines changed

.codacy.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
exclude_paths:
2+
- '*.md'
3+
- 'Tests/Runtime/*.cs'

CHANGELOG.md

-1
This file was deleted.

LICENSE renamed to LICENSE.md

File renamed without changes.
File renamed without changes.

README.md

+22-17
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,39 @@
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.1-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>
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>
1+
<h1 align="center">Gameframe.SaveLoad 👋</h1>
2+
3+
<!-- BADGE-START -->
4+
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/d2749fdbc70f422a9d1efccb56d48bff)](https://www.codacy.com/manual/coryleach/UnitySaveLoad?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=coryleach/UnitySaveLoad&amp;utm_campaign=Badge_Grade)
5+
![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/coryleach/UnitySaveLoad?include_prereleases)
6+
[![license](https://img.shields.io/github/license/coryleach/UnitySaveLoad)](https://github.com/coryleach/UnitySaveLoad/blob/master/LICENSE)
7+
8+
[![twitter](https://img.shields.io/twitter/follow/coryleach.svg?style=social)](https://twitter.com/coryleach)
9+
<!-- BADGE-END -->
10+
11+
Serialization helper utility that supports save, load and encryption.
1512

1613
## Quick Package Install
1714

1815
#### Using UnityPackageManager (for Unity 2019.3 or later)
1916
Open the package manager window (menu: Window > Package Manager)<br/>
2017
Select "Add package from git URL...", fill in the pop-up with the following link:<br/>
21-
https://github.com/coryleach/UnitySaveLoad.git#1.0.1<br/>
18+
https://github.com/coryleach/UnitySaveLoad.git#1.0.2<br/>
2219

2320
#### Using UnityPackageManager (for Unity 2019.1 or later)
2421

2522
Find the manifest.json file in the Packages folder of your project and edit it to look like this:
2623
```js
2724
{
2825
"dependencies": {
29-
"com.gameframe.saveload": "https://github.com/coryleach/UnitySaveLoad.git#1.0.1",
26+
"com.gameframe.saveload": "https://github.com/coryleach/UnitySaveLoad.git#1.0.2",
3027
...
3128
},
3229
}
3330
```
3431

32+
<!-- DOC-START -->
33+
<!--
34+
Changes between 'DOC START' and 'DOC END' will not be modified by readme update scripts
35+
-->
36+
3537
## Usage
3638

3739
SaveLoadManager is not a singleton. Multiple instances may be used and created.<br />
@@ -73,16 +75,19 @@ manager.LoadUnityObjectOverwrite(myScriptableObject,"MyUnityObjectData.data");
7375
Ensure the Json.Net for Unity package has been imported.</br>
7476
In player settings add the string 'JSON_DOT_NET' to Scripting Define Symbols.
7577

78+
<!-- DOC-END -->
79+
7680
## Author
7781

7882
👤 **Cory Leach**
7983

8084
* Twitter: [@coryleach](https://twitter.com/coryleach)
8185
* Github: [@coryleach](https://github.com/coryleach)
8286

87+
8388
## Show your support
8489

8590
Give a ⭐️ if this project helped you!
8691

8792
***
88-
_This README was generated with ❤️ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_
93+
_This README was generated with ❤️ by [Gameframe.Packages](https://github.com/coryleach/unitypackages)_

Runtime/SaveLoadManager.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class SaveLoadManager : ScriptableObject
2626
[SerializeField] protected string salt = string.Empty;
2727
public string Salt => salt;
2828

29-
private Dictionary<SerializationMethodType, ISerializationMethod> _methods = null;
29+
private Dictionary<SerializationMethodType, ISerializationMethod> _methods;
3030

3131
private void OnEnable()
3232
{
@@ -167,7 +167,7 @@ public object LoadWithMethod(SerializationMethodType methodType, Type type, stri
167167
/// <param name="folder">Name of folder to save the file in. Uses defualt folder when null.</param>
168168
public void SaveUnityObject(UnityEngine.Object unityObj, string filename, string folder = null)
169169
{
170-
var savedObj = new JsonSerializedUnityObject()
170+
var savedObj = new JsonSerializedUnityObject
171171
{
172172
jsonData = JsonUtility.ToJson(unityObj)
173173
};
@@ -206,7 +206,7 @@ public bool LoadUnityObjectOverwrite(UnityEngine.Object objectToOverwrite, strin
206206
[Serializable]
207207
private class JsonSerializedUnityObject
208208
{
209-
public string jsonData = null;
209+
public string jsonData;
210210
}
211211

212212
public bool IsEncrypted => (saveMethod == SerializationMethodType.BinaryEncrypted || saveMethod == SerializationMethodType.UnityJsonEncrypted);
@@ -266,7 +266,7 @@ private ISerializationMethod GetSaveLoadMethod(SerializationMethodType methodTyp
266266
#endif
267267

268268
case SerializationMethodType.Custom:
269-
throw new Exception("SaveMethod is Custom but no custom serialization method has been set.");
269+
throw new MissingComponentException("SerializationMethodType is Custom but no custom ISerializationMethod was found.");
270270
default:
271271
throw new ArgumentOutOfRangeException(nameof(methodType), methodType, "SaveLoadMethodType not supported");
272272
}

Runtime/SaveLoadUtility.cs

-22
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ public static class SaveLoadUtility
1212
public static string GetSavePath(string folderName = null, string baseFolderPath = null)
1313
{
1414
return GetRuntimeSavePath(folderName, baseFolderPath);
15-
/*#if UNITY_EDITOR
16-
return GetEditorSavePath(folderName, baseFolderPath);
17-
#else
18-
return GetRuntimeSavePath(folderName, baseFolderPath);
19-
#endif*/
2015
}
2116

2217
public static string GetRuntimeSavePath(string folderName = null, string baseFolderPath = null)
@@ -35,23 +30,6 @@ public static string GetRuntimeSavePath(string folderName = null, string baseFol
3530
savePath = savePath + folderName + "/";
3631
return savePath;
3732
}
38-
39-
public static string GetEditorSavePath(string folderName = null, string baseFolderPath = null)
40-
{
41-
if (string.IsNullOrEmpty(folderName))
42-
{
43-
folderName = DefaultFolderName;
44-
}
45-
46-
if (string.IsNullOrEmpty(baseFolderPath))
47-
{
48-
baseFolderPath = DefaultBaseFolderPath;
49-
}
50-
51-
var savePath = $"{Application.dataPath}/{baseFolderPath}/";
52-
savePath = savePath + folderName + "/";
53-
return savePath;
54-
}
5533

5634
/// <summary>
5735
///

Runtime/SerializationMethodBinaryEncrypted.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ namespace Gameframe.SaveLoad
66
{
77
public class SerializationMethodBinaryEncrypted : ISerializationMethod
88
{
9-
private string _key = null;
10-
private string _salt = null;
9+
private string _key;
10+
private string _salt;
1111

1212
public SerializationMethodBinaryEncrypted(string key, string salt)
1313
{

Runtime/SerializationMethodUnityJsonEncrypted.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ namespace Gameframe.SaveLoad
66
{
77
public class SerializationMethodUnityJsonEncrypted : ISerializationMethodEncrypted
88
{
9-
private string _key = null;
10-
private string _salt = null;
9+
private string _key;
10+
private string _salt;
1111

1212
public SerializationMethodUnityJsonEncrypted(string key, string salt)
1313
{

Runtime/csc.rsp

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-nowarn:CS0649

CHANGELOG.md.meta renamed to Runtime/csc.rsp.meta

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
{
22
"name": "com.gameframe.saveload",
33
"displayName": "Gameframe.SaveLoad",
4-
"version": "1.0.1",
4+
"version": "1.0.2",
55
"description": "Serialization helper utility that supports save, load and encryption.",
66
"keywords": [],
77
"author": {
88
"name": "Cory Leach",
99
"email": "cory.leach@gmail.com",
10-
"url": "https://github.com/coryleach"
11-
}
10+
"url": "https://github.com/coryleach",
11+
"github": "coryleach",
12+
"twitter": "coryleach"
13+
},
14+
"repositoryName": "UnitySaveLoad"
1215
}

0 commit comments

Comments
 (0)