예제 #1
0
        internal void InitializeBuildContext(AddressablesDataBuilderInput builderInput, out AddressableAssetsBuildContext aaContext)
        {
            var aaSettings = builderInput.AddressableSettings;

            m_AllBundleInputDefs     = new List <AssetBundleBuild>();
            m_OutputAssetBundleNames = new List <string>();
            var bundleToAssetGroup = new Dictionary <string, string>();
            var runtimeData        = new ResourceManagerRuntimeData
            {
                CertificateHandlerType        = aaSettings.CertificateHandlerType,
                BuildTarget                   = builderInput.Target.ToString(),
                ProfileEvents                 = builderInput.ProfilerEventsEnabled,
                LogResourceManagerExceptions  = aaSettings.buildSettings.LogResourceManagerExceptions,
                DisableCatalogUpdateOnStartup = aaSettings.DisableCatalogUpdateOnStartup,
                IsLocalCatalogInBundle        = aaSettings.BundleLocalCatalog
            };

            m_Linker = new LinkXmlGenerator();
            m_Linker.SetTypeConversion(typeof(UnityEditor.Animations.AnimatorController), typeof(RuntimeAnimatorController));
            m_Linker.AddTypes(runtimeData.CertificateHandlerType);

            m_ResourceProviderData = new List <ObjectInitializationData>();
            aaContext = new AddressableAssetsBuildContext
            {
                settings           = aaSettings,
                runtimeData        = runtimeData,
                bundleToAssetGroup = bundleToAssetGroup,
                locations          = new List <ContentCatalogDataEntry>(),
                providerTypes      = new HashSet <Type>()
            };

            m_CreatedProviderIds = new HashSet <string>();
        }
예제 #2
0
        /// <inheritdoc />
        protected override TResult BuildDataImplementation <TResult>(AddressablesDataBuilderInput builderInput)
        {
            TResult result = default(TResult);

            var timer = new Stopwatch();

            timer.Start();
            var aaSettings = builderInput.AddressableSettings;

            var locations = new List <ContentCatalogDataEntry>();

            m_AllBundleInputDefs     = new List <AssetBundleBuild>();
            m_OutputAssetBundleNames = new List <string>();
            var bundleToAssetGroup = new Dictionary <string, string>();
            var runtimeData        = new ResourceManagerRuntimeData();

            runtimeData.CertificateHandlerType       = aaSettings.CertificateHandlerType;
            runtimeData.BuildTarget                  = builderInput.Target.ToString();
            runtimeData.ProfileEvents                = builderInput.ProfilerEventsEnabled;
            runtimeData.LogResourceManagerExceptions = aaSettings.buildSettings.LogResourceManagerExceptions;
            m_Linker = new LinkXmlGenerator();
            m_Linker.SetTypeConversion(typeof(UnityEditor.Animations.AnimatorController), typeof(RuntimeAnimatorController));
            m_Linker.AddTypes(runtimeData.CertificateHandlerType);

            m_ResourceProviderData = new List <ObjectInitializationData>();
            var aaContext = new AddressableAssetsBuildContext
            {
                settings           = aaSettings,
                runtimeData        = runtimeData,
                bundleToAssetGroup = bundleToAssetGroup,
                locations          = locations,
                providerTypes      = new HashSet <Type>()
            };

            m_CreatedProviderIds = new HashSet <string>();
            var errorString = ProcessAllGroups(aaContext);

            if (!string.IsNullOrEmpty(errorString))
            {
                result = AddressableAssetBuildResult.CreateResult <TResult>(null, 0, errorString);
            }

            if (result == null)
            {
                result = DoBuild <TResult>(builderInput, aaContext);
            }

            if (result != null)
            {
                result.Duration = timer.Elapsed.TotalSeconds;
            }

            return(result);
        }