ObjectBatch
La référence est en anglais : elle est générée à partir des commentaires du code, écrits en anglais.
public sealed class ObjectBatch : ObjectNamespace NodeWorld.Flux.
Many objects of the world handled in one go, a crossing of the boundary per frame instead of one per object and per value. The batch holds arrays in the memory of the world, one value per object (index i: GetObject(i)):
- the fields given as read ([Read]) are filled by the client before Update, every frame;
- the fields given as write ([Write]) and the material properties are applied by the client after LateUpdate, every frame, all at once (positions, rotations and scales by a Burst job that reads the memory of the world).
The script reads and writes the arrays in between, from any thread (Parallel.For). The objects are those of the list, the children of an object or the objects with a tag, as they are when the batch is made. Client only. Dispose (or Object.Destroy) stops it; it stops with its world.
Properties
count
public int count { get; }The count of objects.
space
public BatchSpace space { get; }The space of positions, rotations and scales.
read
public BatchFields read { get; }The fields the client fills before Update.
write
public BatchFields write { get; }The fields the client applies after LateUpdate.
positions
public Vector3[] positions { get; }A position per object (null if the batch has no Position field).
rotations
public Quaternion[] rotations { get; }A rotation per object (null if the batch has no Rotation field).
scales
public Vector3[] scales { get; }A scale per object (null if the batch has no Scale field); in World space, the scale in the world.
active
public bool[] active { get; }Whether each object is active (null if the batch has no Active field).
Methods
Create
public static ObjectBatch Create(GameObject[] objects, BatchFields read, BatchFields write, BatchSpace space = BatchSpace.World)A batch of these objects (of the world).
FromChildren
public static ObjectBatch FromChildren(Transform parent, BatchFields read, BatchFields write, BatchSpace space = BatchSpace.Local)A batch of the children of parent (not their own children), in their order.
WithTag
public static ObjectBatch WithTag(string tag, BatchFields read, BatchFields write, BatchSpace space = BatchSpace.World)A batch of the active objects of the world with this tag.
GetObject
public GameObject GetObject(int index)The object at index i of the arrays.
AddColorProperty
public Color[] AddColorProperty(string property, int materialIndex = 0)A color property of the material (material index of each object's renderer) per object, applied after LateUpdate to that renderer alone (as Renderer.SetColor: the shared material does not change).
AddFloatProperty
public float[] AddFloatProperty(string property, int materialIndex = 0)A float property of the material per object (as Renderer.SetFloat).
AddVectorProperty
public Vector4[] AddVectorProperty(string property, int materialIndex = 0)A vector property of the material per object (as Renderer.SetVector).
Dispose
public void Dispose()The batch stops: its arrays are no longer read nor applied.
