diff --git a/Assets/UniGLTF/Runtime/UniGLTF/RuntimeGltfInstance.cs b/Assets/UniGLTF/Runtime/UniGLTF/RuntimeGltfInstance.cs
index e1de0da7e..5ec350bdb 100644
--- a/Assets/UniGLTF/Runtime/UniGLTF/RuntimeGltfInstance.cs
+++ b/Assets/UniGLTF/Runtime/UniGLTF/RuntimeGltfInstance.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using System.Linq;
using UnityEngine;
using VRMShaders;
@@ -14,7 +15,12 @@ namespace UniGLTF
///
/// this is UniGLTF root gameObject
///
- public GameObject Root => this.gameObject;
+ public GameObject Root => (this != null) ? this.gameObject : null;
+
+ ///
+ /// Transforms with gltf node index.
+ ///
+ public IReadOnlyList Nodes => _nodes;
///
/// Runtime resources.
@@ -58,6 +64,7 @@ namespace UniGLTF
///
public IReadOnlyList SkinnedMeshRenderers => _skinnedMeshRenderers;
+ private readonly List _nodes = new List();
private readonly List<(SubAssetKey, UnityEngine.Object)> _resources = new List<(SubAssetKey, UnityEngine.Object)>();
private readonly List _materials = new List();
private readonly List _textures = new List();
@@ -70,12 +77,20 @@ namespace UniGLTF
public static RuntimeGltfInstance AttachTo(GameObject go, ImporterContext context)
{
var loaded = go.AddComponent();
+
+ foreach (var node in context.Nodes)
+ {
+ // Maintain index order.
+ loaded._nodes.Add(node);
+ }
+
context.TransferOwnership((k, o) =>
{
if (o == null) return;
loaded._resources.Add((k, o));
+
switch (o)
{
case Material material: