示例#1
0
        static ExtraTypesProvider()
        {
            //@TODO: Only produce JobForEachExtensions.JobStruct_Process1
            //       if there is any use of that specific type in deployed code.

            PlayerBuildInterface.ExtraTypesProvider += () =>
            {
                var extraTypes = new HashSet <string>();

                foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
                {
                    if (!TypeManager.IsAssemblyReferencingEntities(assembly))
                    {
                        continue;
                    }

                    foreach (var type in assembly.GetTypes())
                    {
                        if (typeof(JobForEachExtensions.IBaseJobForEach).IsAssignableFrom(type) && !type.IsAbstract)
                        {
                            AddIJobForEach(type, extraTypes);
                        }
                    }
                }

                TypeManager.Initialize();

                foreach (var typeInfo in TypeManager.AllTypes)
                {
                    if (typeInfo.Type != null)
                    {
                        FastEquality.AddExtraAOTTypes(typeInfo.Type, extraTypes);
                    }
                }

                TypeManager.Shutdown();

                return(extraTypes);
            };
        }
        static ExtraTypesProvider()
        {
            //@TODO: Only produce JobForEachExtensions.JobStruct_Process1
            //       if there is any use of that specific type in deployed code.

            PlayerBuildInterface.ExtraTypesProvider += () =>
            {
                var extraTypes   = new HashSet <string>();
                var visitedTypes = new HashSet <Type>();

                foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
                {
                    if (!TypeManager.IsAssemblyReferencingEntities(assembly))
                    {
                        continue;
                    }

                    foreach (var type in assembly.GetTypes())
                    {
                        AddIJobForEachForTypeHierarchy(extraTypes, visitedTypes, type);
                    }
                }

                TypeManager.Initialize();

                foreach (var typeInfo in TypeManager.AllTypes)
                {
                    Type type = TypeManager.GetType(typeInfo.TypeIndex);
                    if (type != null)
                    {
                        FastEquality.AddExtraAOTTypes(type, extraTypes);
                    }
                }

                return(extraTypes);
            };
        }