Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 1 KB

readEntities.md

File metadata and controls

28 lines (20 loc) · 1 KB

Function: readEntities

Reads all entities from the given BinaryReader and returns a PrefabEntities object.

Signatures

readEntities(reader, prefabName, componentVersions?)

  • reader BinaryReader The BinaryReader containing the entities binary data.
  • prefabName ATTPrefabName The name of the parent prefab.
  • componentVersions (optional, default latest) <Map<number, number>> A map of component versions to ensure are encoded in the binary data.
  • Returns: <PrefabEntities>
import { BinaryReader, readEntities, type ATTPrefabName } from 'att-string-transcoder';

const reader = new BinaryReader('...');
const prefabName = 'Handle_Short' as ATTPrefabName;

const componentVersions = new Map<number, number>([
  [ComponentHash.NetworkRigidbody, 1],
  [ComponentHash.PhysicalMaterialPart, 1],
  [ComponentHash.Pickup, 2]
  // etc...
]);

const component = readEntities(reader, prefabName, componentVersions);