Table of Contents

Class SpellScrollData

Namespace
GrindFest
Assembly
GrindFest.dll

The payload types written by ISerializableComponent implementations - one per component, holding exactly the fields that component stores.

[MemoryPackable(GenerateType.Object)]
public class SpellScrollData : IMemoryPackable<SpellScrollData>, IMemoryPackFormatterRegister
Inheritance
object
SpellScrollData
Implements
IMemoryPackable<SpellScrollData>
IMemoryPackFormatterRegister

Remarks

These four used to be declared inside their components, and one of them (CropData) was even private. That is why the move to MemoryPack missed them: every other save type in this project is a top-level [MemoryPackable] type, and the migration annotated those, while these sat where nothing looked.

Nothing caught it until a player ran. The first item carrying one of these components to be saved threw [MemoryPackSerializationException] GrindFest.LiquidContainerBehaviour+ResourcePotionData is not registered in this provider out of MemoryPackSerializer - a type without [MemoryPackable] has no formatter, and Write<T>(T, byte) serialises by type. Creating a hero was enough to trigger it, because the hero's starting items go through the save path.

They are top-level now for two reasons, and both are load-bearing:

  • MemoryPack's generator needs the type to be partial and reachable, which a private nested type is not;
  • a save-format type belongs with the save format, not hidden inside the MonoBehaviour that happens to use it.

The type names are unchanged and the components were already in this namespace, so no call site moved - only the declarations did. The names are not part of the format either: a payload is a version byte plus an anonymous MemoryPack body, and what identifies it on disk is the component's SaveKey string.

Adding a component means adding its payload type here, as a top-level [MemoryPackable] partial type. A nested one will compile and then throw the moment anything is saved.

Fields

SpellPrefabAddress

Prefab address written by saves made before the migration; still resolves.

TypeName

The spell's type name — what identifies a spell now that the prefabs are gone.

Properties

Reference

Methods

Deserialize(ref MemoryPackReader, ref SpellScrollData?)
RegisterFormatter()
Serialize<TBufferWriter>(ref MemoryPackWriter<TBufferWriter>, ref SpellScrollData?)