Scripting API

Scripting API

EntityRef

Record struct in Abyss.Core, from Abyss.Core.

An entity a component names: a joint's Connected Body, a door's switch, what a follower follows. The number the engine knows the entity by, EntityRef.Entity, or EntityRef.None.

public readonly record struct EntityRef

Remarks

A slot in the Inspector, which takes an entity dragged from the Hierarchy or picked from a list. Saved by the entity's scene id, not by its number, which names it only in the world it was read from: a load gives the field the entity it named, an instance of a prefab the part of that instance, and an entity outside what was saved is written as none, with a note.

Kept naming the same entity as the editor brings entities back with new numbers: Stop putting back what play took away, an undo putting back what was deleted, and a duplicate of several entities, whose copies name each other where the originals did; see Repoint.

Constructors

EntityRef

public EntityRef(ulong Entity)

An entity a component names: a joint's Connected Body, a door's switch, what a follower follows. The number the engine knows the entity by, EntityRef.Entity, or EntityRef.None.

Parameters

  • Entity: The entity's number, as Chunk.Entities gives it; 0 for none.

A slot in the Inspector, which takes an entity dragged from the Hierarchy or picked from a list. Saved by the entity's scene id, not by its number, which names it only in the world it was read from: a load gives the field the entity it named, an instance of a prefab the part of that instance, and an entity outside what was saved is written as none, with a note.

Kept naming the same entity as the editor brings entities back with new numbers: Stop putting back what play took away, an undo putting back what was deleted, and a duplicate of several entities, whose copies name each other where the originals did; see Repoint.

Properties

Entity

public ulong Entity { get; init; }

The entity's number, as Chunk.Entities gives it; 0 for none.

None

public static EntityRef None { get; }

No entity.

IsNone

public bool IsNone { get; }

Whether it names no entity.