< Summary

Class:DCL.PoolInstantiator_GLTF
Assembly:PoolInstantiator_GLTF
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/PoolManager/PoolInstantiator_GLTF/PoolInstantiator_GLTF.cs
Covered lines:7
Uncovered lines:6
Coverable lines:13
Total lines:39
Line coverage:53.8% (7 of 13)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
IsValid(...)0%110100%
Instantiate(...)0%4.463045.45%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/PoolManager/PoolInstantiator_GLTF/PoolInstantiator_GLTF.cs

#LineLine coverage
 1using UnityEngine;
 2using UnityGLTF;
 3
 4namespace DCL
 5{
 6    public class PoolInstantiator_GLTF : IPooledObjectInstantiator
 7    {
 8        public bool IsValid(GameObject original)
 9        {
 110            InstantiatedGLTFObject results = original.GetComponentInChildren<InstantiatedGLTFObject>(true);
 111            return results != null;
 12        }
 13
 14        public GameObject Instantiate(GameObject original)
 15        {
 11616            if (original == null)
 17            {
 018                Debug.LogError("PoolInstantiator_GLTF: Invalid original gameObject!");
 019                return new GameObject("_PoolInstantiator_Error");
 20            }
 21
 11622            InstantiatedGLTFObject gltfInstance = original.GetComponentInChildren<InstantiatedGLTFObject>(true);
 23
 11624            if (gltfInstance == null)
 25            {
 026                Debug.LogWarning("PoolInstantiator_GLTF: Invalid GLTF! Couldn't duplicate correctly.");
 027                GameObject result = Object.Instantiate(original);
 028                result.name += "_Error";
 029                return result;
 30            }
 31
 32            InstantiatedGLTFObject gltfDuplicate = null;
 33
 11634            gltfDuplicate = gltfInstance.Duplicate();
 35
 11636            return gltfDuplicate.gameObject;
 37        }
 38    }
 39}