GetScenesForClass() public method

public GetScenesForClass ( int ID ) : List
ID int
return List
Example #1
0
        private static HashSet <UnityType> GenerateNativeClassList(RuntimeClassRegistry rcr, string directory, string[] rootAssemblies, StrippingInfo strippingInfo)
        {
            if (AssemblyStripper.UseUnityLinkerEngineModuleStripping)
            {
                throw new NotSupportedException("Don't want to rely on this method when UnityLinker EMS is used");
            }

            HashSet <UnityType> nativeClasses = CollectNativeClassListFromRoots(directory, rootAssemblies, strippingInfo);

            // List native classes found in scenes
            foreach (string klassName in rcr.GetAllNativeClassesIncludingManagersAsString())
            {
                UnityType klass = UnityType.FindTypeByName(klassName);
                if (klass != null && klass.baseClass != null)
                {
                    nativeClasses.Add(klass);
                    if (strippingInfo != null)
                    {
                        if (!klass.IsDerivedFrom(GameManagerTypeInfo))
                        {
                            var scenes = rcr.GetScenesForClass(klass.persistentTypeID);
                            if (scenes != null)
                            {
                                foreach (var scene in scenes)
                                {
                                    strippingInfo.RegisterDependency(klassName, scene);
                                    if (scene.EndsWith(".unity"))
                                    {
                                        strippingInfo.SetIcon(scene, "class/SceneAsset");
                                    }
                                    else
                                    {
                                        strippingInfo.SetIcon(scene, "class/AssetBundle");
                                    }
                                }
                            }
                        }
                    }
                }
            }

            // Always include base classes of derived native classes.
            HashSet <UnityType> nativeClassesAndBaseClasses = new HashSet <UnityType>();

            foreach (var klass in nativeClasses)
            {
                var current = klass;
                while (current.baseClass != null)
                {
                    nativeClassesAndBaseClasses.Add(current);
                    current = current.baseClass;
                }
            }

            return(nativeClassesAndBaseClasses);
        }
        private static HashSet <UnityType> GenerateNativeClassList(RuntimeClassRegistry rcr, string directory, string[] rootAssemblies, StrippingInfo strippingInfo)
        {
            HashSet <UnityType> nativeClasses = CollectNativeClassListFromRoots(directory, rootAssemblies, strippingInfo);

            // Inject blacklisted native types
            foreach (var klass in BlackListNativeClasses)
            {
                nativeClasses.Add(klass);
            }

            foreach (var dependent in BlackListNativeClassesDependency.Keys)
            {
                if (nativeClasses.Contains(dependent))
                {
                    var provider = BlackListNativeClassesDependency[dependent];
                    nativeClasses.Add(provider);
                }
            }

            // List native classes found in scenes
            foreach (string klassName in rcr.GetAllNativeClassesIncludingManagersAsString())
            {
                UnityType klass = UnityType.FindTypeByName(klassName);
                if (klass != null && klass.baseClass != null)
                {
                    nativeClasses.Add(klass);
                    if (strippingInfo != null)
                    {
                        if (!klass.IsDerivedFrom(GameManagerTypeInfo))
                        {
                            var scenes = rcr.GetScenesForClass(klass.persistentTypeID);
                            if (scenes != null)
                            {
                                foreach (var scene in scenes)
                                {
                                    strippingInfo.RegisterDependency(klassName, scene);
                                    if (scene.EndsWith(".unity"))
                                    {
                                        strippingInfo.SetIcon(scene, "class/SceneAsset");
                                    }
                                    else
                                    {
                                        strippingInfo.SetIcon(scene, "class/AssetBundle");
                                    }
                                }
                            }
                        }
                    }
                }
            }

            // Always include base classes of derived native classes.
            HashSet <UnityType> nativeClassesAndBaseClasses = new HashSet <UnityType>();

            foreach (var klass in nativeClasses)
            {
                var current = klass;
                while (current.baseClass != null)
                {
                    nativeClassesAndBaseClasses.Add(current);
                    current = current.baseClass;
                }
            }

            return(nativeClassesAndBaseClasses);
        }
Example #3
0
        private static HashSet <UnityType> GenerateNativeClassList(RuntimeClassRegistry rcr, string directory, string[] rootAssemblies, StrippingInfo strippingInfo)
        {
            HashSet <UnityType> hashSet = CodeStrippingUtils.CollectNativeClassListFromRoots(directory, rootAssemblies, strippingInfo);

            UnityType[] blackListNativeClasses = CodeStrippingUtils.BlackListNativeClasses;
            for (int i = 0; i < blackListNativeClasses.Length; i++)
            {
                UnityType item = blackListNativeClasses[i];
                hashSet.Add(item);
            }
            foreach (UnityType current in CodeStrippingUtils.BlackListNativeClassesDependency.Keys)
            {
                if (hashSet.Contains(current))
                {
                    UnityType item2 = CodeStrippingUtils.BlackListNativeClassesDependency[current];
                    hashSet.Add(item2);
                }
            }
            foreach (string current2 in rcr.GetAllNativeClassesIncludingManagersAsString())
            {
                UnityType unityType = UnityType.FindTypeByName(current2);
                if (unityType != null && unityType.baseClass != null)
                {
                    hashSet.Add(unityType);
                    if (strippingInfo != null)
                    {
                        if (!unityType.IsDerivedFrom(CodeStrippingUtils.GameManagerTypeInfo))
                        {
                            List <string> scenesForClass = rcr.GetScenesForClass(unityType.persistentTypeID);
                            if (scenesForClass != null)
                            {
                                foreach (string current3 in scenesForClass)
                                {
                                    strippingInfo.RegisterDependency(current2, current3);
                                    if (current3.EndsWith(".unity"))
                                    {
                                        strippingInfo.SetIcon(current3, "class/SceneAsset");
                                    }
                                    else
                                    {
                                        strippingInfo.SetIcon(current3, "class/AssetBundle");
                                    }
                                }
                            }
                        }
                    }
                }
            }
            HashSet <UnityType> hashSet2 = new HashSet <UnityType>();

            foreach (UnityType current4 in hashSet)
            {
                UnityType unityType2 = current4;
                while (unityType2.baseClass != null)
                {
                    hashSet2.Add(unityType2);
                    unityType2 = unityType2.baseClass;
                }
            }
            return(hashSet2);
        }