< Summary

Class:DCL.Asset_AB_GameObject
Assembly:AssetPromiseKeeper
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/AssetManager/AssetBundles/AB_GameObject/Asset_AB_GameObject.cs
Covered lines:37
Uncovered lines:0
Coverable lines:37
Total lines:76
Line coverage:100% (37 of 37)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Asset_AB_GameObject()0%110100%
Clone()0%110100%
Cleanup()0%110100%
Show(...)0%220100%
Hide()0%110100%
SetTextures(...)0%220100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/AssetManager/AssetBundles/AB_GameObject/Asset_AB_GameObject.cs

#LineLine coverage
 1using System.Collections.Generic;
 2using DCL.Configuration;
 3using MainScripts.DCL.Analytics.PerformanceAnalytics;
 4using UnityEngine;
 5
 6namespace DCL
 7{
 8    public class Asset_AB_GameObject : Asset_WithPoolableContainer
 9    {
 10        private const string CONTAINER_GO_NAME = "AB Container";
 11
 12        internal AssetPromise_AB ownerPromise;
 13
 42414        public override GameObject container { get; set; }
 2015        public Dictionary<Mesh, int> meshToTriangleCount = new Dictionary<Mesh, int>();
 2016        public HashSet<Renderer> renderers = new HashSet<Renderer>();
 2017        public HashSet<Mesh> meshes = new HashSet<Mesh>();
 2018        public HashSet<Material> materials = new HashSet<Material>();
 2019        public HashSet<Texture> textures = new HashSet<Texture>();
 2020        public HashSet<AnimationClip> animationClips = new HashSet<AnimationClip>();
 21        public int totalTriangleCount = 0;
 22        public long animationClipSize = 0;
 23        public long meshDataSize = 0;
 24
 2025        public Asset_AB_GameObject()
 26        {
 2027            container = new GameObject(CONTAINER_GO_NAME);
 28            // Hide gameobject until it's been correctly processed, otherwise it flashes at 0,0,0
 2029            container.transform.position = EnvironmentSettings.MORDOR;
 2030        }
 31
 32        public override object Clone()
 33        {
 3734            Asset_AB_GameObject result = this.MemberwiseClone() as Asset_AB_GameObject;
 3735            result.meshes = new HashSet<Mesh>(meshes);
 3736            result.meshToTriangleCount = new Dictionary<Mesh, int>(meshToTriangleCount);
 3737            result.renderers = new HashSet<Renderer>(renderers);
 3738            result.materials = new HashSet<Material>(materials);
 3739            result.textures = new HashSet<Texture>(textures);
 3740            result.animationClips = new HashSet<AnimationClip>(animationClips);
 3741            return result;
 42        }
 43
 44        public override void Cleanup()
 45        {
 2146            AssetPromiseKeeper_AB.i.Forget(ownerPromise);
 2147            Object.Destroy(container);
 2148            meshes.Clear();
 2149            meshToTriangleCount.Clear();
 2150            renderers.Clear();
 2151            materials.Clear();
 2152            textures.Clear();
 2153            animationClips.Clear();
 2154        }
 55
 56        public void Show(System.Action OnFinish)
 57        {
 2558            OnFinish?.Invoke();
 2559        }
 60
 61        public void Hide()
 62        {
 163            container.transform.parent = null;
 164            container.transform.position = EnvironmentSettings.MORDOR;
 165        }
 66        public void SetTextures(HashSet<Texture> texturesHashSet)
 67        {
 1268            textures = texturesHashSet;
 69
 4870            for (int i = 0; i < textures.Count; i++)
 71            {
 1272                PerformanceAnalytics.ABTextureTracker.Track();
 73            }
 1274        }
 75    }
 76}