1
- # JSON Serializer Package
2
- <i >A JSON serializer package for Unity which supports reading from and writing to JSON files. </i >
1
+ # JSON Serializer Plugin
2
+ <i >A JSON serializer plugin for Unity which supports reading from and writing to JSON files. </i >
3
3
4
- Check out [ releases] ( https://github.com/Persomatey/JSONSerializePackage /releases ) to download the unity package.
4
+ Check out [ releases] ( https://github.com/Persomatey/JSONSerializePlugin /releases ) to download the unity package.
5
5
6
6
<img src =" https://raw.githubusercontent.com/Persomatey/JSONSerializerPlugin/main/Logo/JSONSerializerPluginLogo.png " width =" 318 " />
7
7
8
8
## Tutorial
9
+ <details >
10
+ <summary >Tutorial</summary >
9
11
10
12
### Setup
11
13
Since everything in this plugin is wrapped in a JSON namespace, you'll need to add it at the top of your script.
@@ -18,7 +20,7 @@ Because .json files are read as TextAssets in Unity, you'll need a reference to
18
20
[SerializeField] TextAsset file;
19
21
public TextAsset file;
20
22
```
21
-
23
+ ---
22
24
### Creating a new JSON object from a file
23
25
Call the constructor, using the TextAsset you want read in the parameters.
24
26
```
@@ -28,7 +30,7 @@ There is also a constructor for if you don't have a parameter.
28
30
```
29
31
JSON myJSON = new JSON();
30
32
```
31
-
33
+ ---
32
34
### Serializing JSON object to a file
33
35
You can serialize the JSON object to the provided TextAsset file.
34
36
```
@@ -38,7 +40,7 @@ If no parameter was provided when object was created, you'll need to include the
38
40
```
39
41
writeJSON.WriteToFile(file);
40
42
```
41
-
43
+ ---
42
44
### Reading and writing JSON variables
43
45
To read a specific variable (` GetBool ` , ` GetInt ` , ` GetFloat ` , ` GetString ` ):
44
46
```
@@ -52,6 +54,8 @@ To add a variable to the JSON (`AddBool`, `AddInt`, `AddFloat`, `AddString`):
52
54
```
53
55
myJSON.AddFloat("myFloat", 24.68);
54
56
```
57
+ ---
58
+ </details >
55
59
56
60
## Details
57
61
0 commit comments