Class GameObjectInstantiator
Generates a GameObject hierarchy from a glTF scene
Implements
Inherited Members
Namespace: GLTFast
Assembly: solution.dll
Syntax
public class GameObjectInstantiator : IInstantiator
Constructors
| Name | Description |
|---|---|
| GameObjectInstantiator(IGltfReadable, Transform, ICodeLogger, InstantiationSettings) | Constructs a GameObjectInstantiator |
Fields
| Name | Description |
|---|---|
| m_Gltf | glTF to instantiate from |
| m_Logger | Instantiation logger |
| m_Nodes | glTF node index to instantiated GameObject dictionary |
| m_Parent | Generated GameObjects will get parented to this Transform |
| m_Settings | Instantiation settings |
Properties
| Name | Description |
|---|---|
| SceneInstance | Contains information about the latest instance of a glTF scene |
| SceneTransform | Transform representing the scene. Root nodes will get parented to it. |
Methods
| Name | Description |
|---|---|
| AddAnimation(AnimationClip[]) | Adds animation clips to the current scene. Only available if the built-in Animation module is enabled. |
| AddCamera(uint, uint) | Called when a node has a camera assigned |
| AddLightPunctual(uint, uint) | Called when a node has a punctual light assigned (KHR_lights_punctual) |
| AddPrimitive(uint, string, MeshResult, uint[], uint?, float[], int) | Called for adding a Primitive/Mesh to a Node. |
| AddPrimitiveInstanced(uint, string, MeshResult, uint, NativeArray<Vector3>?, NativeArray<Quaternion>?, NativeArray<Vector3>?, int) | Called for adding a Primitive/Mesh to a Node that uses GPU instancing (EXT_mesh_gpu_instancing) to render the same mesh/material combination many times. Similar to/called instead of AddPrimitive(uint, string, MeshResult, uint[], uint?, float[], int), without joints/skin support. |
| BeginScene(string, uint[]) | Starts creating a scene instance. Has to be called at first and concluded by calling EndScene(uint[]). |
| CreateNode(uint, uint?, Vector3, Quaternion, Vector3) | Called for every Node in the glTF file |
| EndScene(uint[]) | Is called at last, after all scene content has been created. Immediately afterwards the scene will be rendered, so use it to finally prepare the instance. |
| SetNodeName(uint, string) | Sets the name of a node. If a node has no name it falls back to the first valid mesh name. Null otherwise. |
Events
| Name | Description |
|---|---|
| EndSceneCompleted | Invoked after a scene has been instantiated. |
| MeshAdded | Invoked after a mesh was added to a node GameObject |
| NodeCreated | Invoked when a node's GameObject has been created. |