Reads all components from the given BinaryReader
and returns a PrefabComponents
object.
reader
BinaryReader
TheBinaryReader
containing the components binary data.versions
(optional, default latest)<Map<number, number>>
A map of component versions to ensure are encoded in the binary data.- Returns:
<PrefabComponents>
import { BinaryReader, readComponents } from 'att-string-transcoder';
const reader = new BinaryReader('...');
const versions = new Map<number, number>([
[ComponentHash.NetworkRigidbody, 1],
[ComponentHash.PhysicalMaterialPart, 1],
[ComponentHash.Pickup, 2]
// etc...
]);
const component = readComponents(reader, versions);