diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/ImporterContext.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/ImporterContext.cs index 1634b8192..50cff20c5 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/ImporterContext.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/ImporterContext.cs @@ -146,7 +146,7 @@ namespace UniGLTF var nodes = new List(); for (int i = 0; i < Nodes.Count; ++i) { - nodes.Add(NodeImporter.BuildHierarchy(this, i)); + nodes.Add(NodeImporter.BuildHierarchy(GLTF, i, Nodes, Meshes)); } NodeImporter.FixCoordinate(this, nodes, inverter); diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/NodeImporter.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/NodeImporter.cs index 940653521..8461da81c 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/NodeImporter.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/NodeImporter.cs @@ -64,9 +64,9 @@ namespace UniGLTF public int? SkinIndex; } - public static TransformWithSkin BuildHierarchy(ImporterContext context, int i) + public static TransformWithSkin BuildHierarchy(glTF gltf, int i, List nodes, List meshes) { - var go = context.Nodes[i].gameObject; + var go = nodes[i].gameObject; if (string.IsNullOrEmpty(go.name)) { go.name = string.Format("node{0:000}", i); @@ -80,12 +80,12 @@ namespace UniGLTF // // build hierarchy // - var node = context.GLTF.nodes[i]; + var node = gltf.nodes[i]; if (node.children != null) { foreach (var child in node.children) { - context.Nodes[child].transform.SetParent(context.Nodes[i].transform, + nodes[child].transform.SetParent(nodes[i].transform, false // node has local transform ); } @@ -96,7 +96,7 @@ namespace UniGLTF // if (node.mesh != -1) { - var mesh = context.Meshes[node.mesh]; + var mesh = meshes[node.mesh]; if (mesh.Mesh.blendShapeCount == 0 && node.skin == -1) { // without blendshape and bone skinning