You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Documentation~/docs/4-fundamentals/creating-custom-class.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,7 @@ namespace Custom.Variable
16
16
{
17
17
}
18
18
19
+
[Serializable]
19
20
publicstructHealth
20
21
{
21
22
publicfloatcurrent;
@@ -26,3 +27,6 @@ namespace Custom.Variable
26
27
27
28
Creating custom class is encouraged as you can setup the namespace in accordance to your projects.
28
29
This is beneficial if you try to track references, so that you don't ended up in a general Kassets' namespace.
30
+
31
+
**Serializable**
32
+
It is important to note that your custom struct or class needs to have the Serializable attribute. Otherwise you will see null reference exceptions as the editor inspector cannot find the value of the class.
0 commit comments