Show / Hide Table of Contents

Class JsonSaveableComponent

Inheritance
System.Object
SaveableComponent
JsonSaveableComponent
Namespace: GlitchedPolygons.SavegameFramework.Json
Assembly: UnityScriptsLibrary.dll
Syntax
public abstract class JsonSaveableComponent : SaveableComponent

Properties

| Improve this Doc View Source

ID

The JsonSaveableComponent's ID. This is a unique identifier that should be immutable and persistent.

Declaration
public override int ID { get; }
Property Value
Type Description
System.Int32
Overrides
SaveableComponent.ID

Methods

| Improve this Doc View Source

AfterLoading()

This is called after a successful Load(String).

Child classes should implement this and define what happens after the Load(String) fed the stored data into this class (e.g. if a SaveableComponent's Transform.position is stored in the savegame, this would be the place to then take that value and load it back into the Transform).

Declaration
public abstract override void AfterLoading()
Overrides
SaveableComponent.AfterLoading()
| Improve this Doc View Source

Awake()

Declaration
protected virtual void Awake()
| Improve this Doc View Source

BeforeSaving()

This is called by the SavegameManager implementation before saving this instance's data out to the savegame.

Use this to sync up any data if you need (e.g. loading Unity component data - which is NOT serialized alongside automatically; keep that in mind! - into some field on the savegame like for example a "Vector3 positionCoordinates;" or something like that, yea..)

Declaration
public abstract override void BeforeSaving()
Overrides
SaveableComponent.BeforeSaving()
| Improve this Doc View Source

OnDestroy()

Declaration
protected virtual void OnDestroy()
| Improve this Doc View Source

PrintID()

Declaration
protected void PrintID()

Operators

| Improve this Doc View Source

Implicit(JsonSaveableComponent to JsonSaveableComponentTuple)

Converts a JsonSaveableComponent instance to a JsonSaveableComponentTuple, ready to be serialized out into a JsonSavegame.

Declaration
public static implicit operator JsonSaveableComponentTuple(JsonSaveableComponent component)
Parameters
Type Name Description
JsonSaveableComponent component

JsonSaveableComponent to convert.

Returns
Type Description
JsonSaveableComponentTuple

new JsonSaveableComponentTuple { id = component.ID, json = JsonUtility.ToJson(component) }

  • Improve this Doc
  • View Source
Back to top Generated by DocFX