Scripting API

Scripting API

SpawnBatch

Struct in Abyss.Core, from Abyss.Core.

A pending batch of new entities, whose initial component values are written through spans.

public readonly ref struct SpawnBatch

Remarks

A ref struct because the spans it hands out point into the command buffer and are invalidated by the next recording on it. The compiler stops one being kept past that point.

Properties

Count

public int Count { get; }

Number of entities this batch creates.

Entities

public ReadOnlySpan<ulong> Entities { get; }

The ids of the entities this batch will create.

Available immediately, before the command is applied, so a system can reference what it is creating during the same frame — storing a handle, linking a parent. The entities themselves do not exist until the buffer is applied at the end of the frame.

Methods

GetSpan<T>

public Span<T> GetSpan<T>(int component) where T : unmanaged

The initial values of one component, by the index it holds in the archetype.

Type parameters

  • T

Parameters

  • component

Starts zeroed, so a component left untouched is created zeroed rather than holding whatever the buffer last contained.