Class
JSONSceneImporter
View sourceExtendsImporter
Imports JSON-backed Scene assets through the Importer
contract.
ScenePlugin installs this importer for the json extension.
Examples
const importer = new JSONSceneImporter()
const scene = await importer.deserialize(response, typeRegistry)Constructor
View source
Methods
deserialize(response: Response, typeRegistry: TypeRegistry): Promise<Scene>
View sourceParses a response body and reconstructs a Scene from its JSON
representation. API users can pass the response from a scene asset request
together with the app’s TypeRegistry to restore the serialized
component and resource values.
The response JSON is awaited, then each entity component and scene resource
is resolved through the supplied TypeRegistry: its runtime type ID
selects the registry entry, whose deserialize method receives the stored
value. Unknown types, non-object deserialization results, invalid entity IDs,
and malformed entity/component/resource shapes are warned about or skipped,
so the result can be empty or partial while valid data is retained. A valid
JSON value that is not an object produces an empty Scene.
Malformed JSON causes response.json() to reject, and an exception thrown
by a registered deserializer also propagates because this method does not
catch either failure.
getExtensions(): string[]
View sourceReturns the file extension handled by this importer.
