Scripting API

Scripting API

PrefabRef

Struct in Abyss.Core, from Abyss.Core.

A prefab a component names: a hand-made .prefab or a model, kept by its identity, which the inspector's slot is given by dragging the file onto it from the Project panel.

public readonly struct PrefabRef

Remarks

An identity, not a path, so moving or renaming the file never breaks it: a scene writes the path beside it, which is what it falls back on when the identity is not found. Nothing is loaded by holding one; AssetAccess.LoadPrefab loads it, as a path or an address is loaded, and a built game finds it through its pack's AssetCatalog.

Sixteen bytes, described as one field of two whole numbers: the identity's first eight bytes and its last, as PrefabInstance holds one. A component holding one is copied, written and read back as any is.

Constructors

PrefabRef

public PrefabRef(AssetGuid id)

A reference to the prefab or model of id.

Parameters

  • id

PrefabRef

public PrefabRef(ulong low, ulong high)

A reference made of the two numbers it is held as.

Parameters

  • low: The identity's first eight bytes, little-endian.
  • high: Its last eight.

Properties

None

public static PrefabRef None { get; }

No prefab.

IsNone

public bool IsNone { get; }

Whether this names no prefab.

Id

public AssetGuid Id { get; }

The prefab's or the model's identity; AssetGuid.None for none.

Low

public ulong Low { get; }

The identity's first eight bytes, as the field's first number holds them.

High

public ulong High { get; }

Its last eight, as the field's second number holds them.

Methods

Equals

public bool Equals(PrefabRef other)

Parameters

  • other

Equals

public override bool Equals(object? obj)

Parameters

  • obj

GetHashCode

public override int GetHashCode()

ToString

public override string ToString()

The identity, or none.

Operators

operator ==

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

Two references to one prefab.

Parameters

  • left
  • right

operator !=

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

Two references to different prefabs.

Parameters

  • left
  • right