Table of Contents

Struct EntitySaveId

Namespace
ElectricDrill.AstraRpgFramework
Assembly
com.electricdrill.astra-rpg-framework.Runtime.dll

Opt-in, stable identity for an EntityCore. It exists purely as a hook for an external save system: it lets a save record be correlated back to a specific entity instance across a save/load cycle, which a Unity object reference — the only identity an entity has today — cannot survive.

[Serializable]
public struct EntitySaveId

Remarks

The framework itself never reads this value: there is no registry, no lookup, no internal behavior keyed off it. An entity with an empty id behaves exactly like one with an assigned id.

Backed by a string rather than System.Guid (Unity does not serialize Guid) or a byte array: a string is what any save format — JSON keys, dictionaries, PlayerPrefs — needs as a key anyway, and it keeps scene/prefab YAML diffs to a single line. Generated ids use Guid.NewGuid().ToString("N"), but any non-empty string a save system hands back through SetSaveId(EntitySaveId) is accepted as-is.

Deliberately not named EntityId: UnityEngine.EntityId (Unity 6.2+) is a different, session-scoped concept, and a type with that name in this namespace would shadow it for every file in the framework.

Constructors

EntitySaveId(string)

Wraps an existing id string, typically one read back from save data. Null, empty, and whitespace-only values all normalize to Empty.

public EntitySaveId(string value)

Parameters

value string

The id string to wrap.

Fields

Empty

The unassigned id. Every entity starts here until an id is explicitly baked or set.

public static readonly EntitySaveId Empty

Field Value

EntitySaveId

Properties

IsEmpty

Whether this id is unassigned.

public bool IsEmpty { get; }

Property Value

bool

Value

The underlying id string — the value to write into save data. Never null: an unassigned id reads as the empty string.

public string Value { get; }

Property Value

string

Methods

Equals(EntitySaveId)

public bool Equals(EntitySaveId other)

Parameters

other EntitySaveId

Returns

bool

Equals(object)

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

New()

Mints a fresh, random id.

public static EntitySaveId New()

Returns

EntitySaveId

ToString()

Returns Value.

public override string ToString()

Returns

string

Operators

operator ==(EntitySaveId, EntitySaveId)

public static bool operator ==(EntitySaveId left, EntitySaveId right)

Parameters

left EntitySaveId
right EntitySaveId

Returns

bool

operator !=(EntitySaveId, EntitySaveId)

public static bool operator !=(EntitySaveId left, EntitySaveId right)

Parameters

left EntitySaveId
right EntitySaveId

Returns

bool