Repository: playcanvas/engine
File: src/framework/parsers/glb-container-resource.js (JavaScript)

Code before:
                    entity: entity
                });
            }

            // if the node is instanced, hook up instancing
            const instData = nodeInstancingMap.get(gltfNode);
            if (instData) {

                const matrices = instData.matrices;
                const vbFormat = VertexFormat.getDefaultInstancingFormat(mesh.device);
                const vb = new VertexBuffer(mesh.device, vbFormat, matrices.length / 16, {
                    data: matrices
                });
                meshInstance.setInstancing(vb);

                // mark the vertex buffer for destruction when the mesh instance is destroyed
                meshInstance.instancingData._destroyVertexBuffer = true;
            }

            return meshInstance;
        };

        // helper function to recursively clone a hierarchy of GraphNodes to Entities
        const cloneHierarchy = (root, node, glb) => {

            const entity = new Entity('Untitled', this._assets._loader._app);
            node._cloneInternal(entity);

            // first entity becomes the root
            if (!root) root = entity;

            // find all components needed for this node
            let attachedMi = null;
            let renderAsset = null;
            for (let i = 0; i < glb.nodes.length; i++) {
                const glbNode = glb.nodes[i];
                if (glbNode === node) {
                    const gltfNode = glb.gltf.nodes[i];

                    // mesh
                    if (gltfNode.hasOwnProperty('mesh')) {
                        const meshGroup = glb.renders[gltfNode.mesh].meshes;
                        renderAsset = this.renders[gltfNode.mesh];
                        for (let mi = 0; mi < meshGroup.length; mi++) {
                            const mesh = meshGroup[mi];
                            if (mesh) {
                                const cloneMi = createMeshInstance(root, entity, mesh, glb.materials, glb.meshDefaultMaterials, glb.skins, gltfNode, glb.nodeInstancingMap);

                                // add it to list
                                if (!attachedMi) {
                                    attachedMi = [];

Review comment (suggestion):
just pass `undefined` instead of 'Untitled', let the underlaying code handle the default

Code after:
                    entity: entity
                });
            }

            // if the node is instanced, hook up instancing
            const instData = nodeInstancingMap.get(gltfNode);
            if (instData) {

                const matrices = instData.matrices;
                const vbFormat = VertexFormat.getDefaultInstancingFormat(mesh.device);
                const vb = new VertexBuffer(mesh.device, vbFormat, matrices.length / 16, {
                    data: matrices
                });
                meshInstance.setInstancing(vb);

                // mark the vertex buffer for destruction when the mesh instance is destroyed
                meshInstance.instancingData._destroyVertexBuffer = true;
            }

            return meshInstance;
        };

        // helper function to recursively clone a hierarchy of GraphNodes to Entities
        const cloneHierarchy = (root, node, glb) => {

            const entity = new Entity(undefined, this._assets._loader._app);
            node._cloneInternal(entity);

            // first entity becomes the root
            if (!root) root = entity;

            // find all components needed for this node
            let attachedMi = null;
            let renderAsset = null;
            for (let i = 0; i < glb.nodes.length; i++) {
                const glbNode = glb.nodes[i];
                if (glbNode === node) {
                    const gltfNode = glb.gltf.nodes[i];

                    // mesh
                    if (gltfNode.hasOwnProperty('mesh')) {
                        const meshGroup = glb.renders[gltfNode.mesh].meshes;
                        renderAsset = this.renders[gltfNode.mesh];
                        for (let mi = 0; mi < meshGroup.length; mi++) {
                            const mesh = meshGroup[mi];
                            if (mesh) {
                                const cloneMi = createMeshInstance(root, entity, mesh, glb.materials, glb.meshDefaultMaterials, glb.skins, gltfNode, glb.nodeInstancingMap);

                                // add it to list
                                if (!attachedMi) {
                                    attachedMi = [];