public SceneGraphExtractor(Object root)
    {
        this.m_root = root;
        foreach (string memCategory in SceneGraphExtractor.MemCategories)
        {
            this.MemObjectIDs[memCategory] = new List <int>();
        }
        GameObject root1 = this.m_root as GameObject;

        if (!Object.op_Inequality((Object)root1, (Object)null))
        {
            return;
        }
        this.ProcessRecursively(root1);
        this.ExtractComponentIDs <Camera>(root1);
        if (SceneGraphExtractor.UIWidgetExtractor != null)
        {
            using (List <Object> .Enumerator enumerator = SceneGraphExtractor.UIWidgetExtractor(root1).GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    this.CountMemObject(enumerator.Current);
                }
            }
        }
        foreach (MeshFilter componentsInChild in root1.GetComponentsInChildren(typeof(MeshFilter), true))
        {
            this.CountMemObject((Object)componentsInChild.get_sharedMesh());
        }
        foreach (Renderer componentsInChild in root1.GetComponentsInChildren(typeof(Renderer), true))
        {
            if (Object.op_Inequality((Object)componentsInChild.get_sharedMaterial(), (Object)null))
            {
                this.CountMemObject((Object)componentsInChild.get_sharedMaterial());
                using (List <Texture2D> .Enumerator enumerator = ResourceTracker.Instance.GetTexture2DObjsFromMaterial(componentsInChild.get_sharedMaterial()).GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        this.CountMemObject((Object)enumerator.Current);
                    }
                }
            }
        }
        this.ExtractComponentIDs <Animator>(root1);
        this.ExtractComponentIDs <ParticleSystem>(root1);
    }
Пример #2
0
    private void ExtractObjectResources(Object obj, int reqSeqID)
    {
        SceneGraphExtractor sceneGraphExtractor = new SceneGraphExtractor(obj);

        for (int index = 0; index < sceneGraphExtractor.GameObjectIDs.Count; ++index)
        {
            if (!this.TrackedGameObjects.ContainsKey(sceneGraphExtractor.GameObjectIDs[index]))
            {
                this.TrackedGameObjects[sceneGraphExtractor.GameObjectIDs[index]] = reqSeqID;
            }
        }
        foreach (KeyValuePair <string, List <int> > memObjectId in sceneGraphExtractor.MemObjectIDs)
        {
            foreach (int key in memObjectId.Value)
            {
                if (!this.TrackedMemObjects.ContainsKey(key))
                {
                    this.TrackedMemObjects[key] = reqSeqID;
                }
            }
        }
    }
    private void ExtractObjectResources(UnityEngine.Object obj, int reqSeqID)
    {
        SceneGraphExtractor sge = new SceneGraphExtractor(obj);

        for (int i = 0; i < sge.GameObjectIDs.Count; i++)
        {
            if (!TrackedGameObjects.ContainsKey(sge.GameObjectIDs[i]))
            {
                TrackedGameObjects[sge.GameObjectIDs[i]] = reqSeqID;
            }
        }

        foreach (var p in sge.MemObjectIDs)
        {
            foreach (var item in p.Value)
            {
                if (!TrackedMemObjects.ContainsKey(item))
                {
                    TrackedMemObjects[item] = reqSeqID;
                }
            }
        }
    }