Modding:Serialization (Saving/Loading): Difference between revisions

Jump to navigation Jump to search
m
Woopsed namespace end brace
(→‎How Serialization Works for Qud: add using directives)
m (Woopsed namespace end brace)
 
(2 intermediate revisions by one other user not shown)
Line 17: Line 17:
<syntaxhighlight lang="C#">
<syntaxhighlight lang="C#">
using System;
using System;
using UnityEngine;
using SerializeField = UnityEngine.SerializeField;
</syntaxhighlight>
</syntaxhighlight>


Line 26: Line 26:
<syntaxhighlight lang="c#">
<syntaxhighlight lang="c#">
using System;
using System;
using UnityEngine;
using SerializeField = UnityEngine.SerializeField;


namespace XRL.World.Parts
namespace XRL.World.Parts
Line 44: Line 44:
         }
         }
     }
     }
}
</syntaxhighlight>Object fields are not serialized automatically. If your class introduces a new field for an object type or a container of objects, such as a GameObject field that stores a reference to some particular object, a List<LiquidVolume> that stores a list of liquid volumes, or a completely new type of object introduced by your mod, you must implement custom serialization for those object fields, or your object references will no longer be valid after the game is reloaded.
</syntaxhighlight>Object fields are not serialized automatically. If your class introduces a new field for an object type or a container of objects, such as a GameObject field that stores a reference to some particular object, a List<LiquidVolume> that stores a list of liquid volumes, or a completely new type of object introduced by your mod, you must implement custom serialization for those object fields, or your object references will no longer be valid after the game is reloaded.


Navigation menu