コード例 #1
0
        public void BuildContentUpdate()
        {
            var group = Settings.CreateGroup("LocalStuff3", false, false, false, null);

            Settings.BuildRemoteCatalog     = true;
            Settings.RemoteCatalogBuildPath = new ProfileValueReference();
            Settings.RemoteCatalogBuildPath.SetVariableByName(Settings, AddressableAssetSettings.kRemoteBuildPath);
            Settings.RemoteCatalogLoadPath = new ProfileValueReference();
            Settings.RemoteCatalogLoadPath.SetVariableByName(Settings, AddressableAssetSettings.kRemoteLoadPath);
            var schema = group.AddSchema <BundledAssetGroupSchema>();

            schema.BuildPath.SetVariableByName(Settings, AddressableAssetSettings.kLocalBuildPath);
            schema.LoadPath.SetVariableByName(Settings, AddressableAssetSettings.kLocalLoadPath);
            schema.BundleMode = BundledAssetGroupSchema.BundlePackingMode.PackTogether;
            group.AddSchema <ContentUpdateGroupSchema>().StaticContent = true;
            Settings.CreateOrMoveEntry(m_AssetGUID, group);
            var context = new AddressablesDataBuilderInput(Settings);

            var op = Settings.ActivePlayerDataBuilder.BuildData <AddressablesPlayerBuildResult>(context);

            Assert.IsTrue(string.IsNullOrEmpty(op.Error), op.Error);
            var tempPath = Path.GetDirectoryName(Application.dataPath) + "/Library/com.unity.addressables/StreamingAssetsCopy/" + PlatformMappingService.GetPlatform() + "/addressables_content_state.bin";
            var buildOp  = ContentUpdateScript.BuildContentUpdate(Settings, tempPath);

            Assert.IsNotNull(buildOp);
            Assert.IsTrue(string.IsNullOrEmpty(buildOp.Error));
        }
コード例 #2
0
    public static void BuildContentUpdate()
    {
        var buildPath = ContentUpdateScript.GetContentStateDataPath(false);
        var settings  = AddressableAssetSettingsDefaultObject.Settings;

        ContentUpdateScript.BuildContentUpdate(settings, buildPath);
    }
コード例 #3
0
        public static string Build()
        {
            RefreshAssetsList();

            var path = ContentUpdateScript.GetContentStateDataPath(false);
            var res  = "";

            if (File.Exists(path))
            {
                // すでにStateDataがあれば、ContentUpdate(差分)ビルドします
                var result = ContentUpdateScript.BuildContentUpdate(AddressableAssetSettingsDefaultObject.Settings, path);
                if (result != null)
                {
                    res = result.Error;
                }
                else
                {
                    // エラーが発生したため、初回ビルドとして処理する
                    AddressableAssetSettings.BuildPlayerContent();
                    Debug.Log("BuildContentUpdate Error:初回ビルドで処理する");
                }
            }
            else
            {
                // StateDataがなければ、初回ビルドする
                AddressableAssetSettings.BuildPlayerContent();
            }
            return(res);
        }
コード例 #4
0
    public static void BuildUpdate()
    {
        CreateVersionBuild.CreateVersion();
        SetDataBuilder();
        string path = ContentUpdateScript.GetContentStateDataPath(false);

        ContentUpdateScript.BuildContentUpdate(AddressableAssetSettingsDefaultObject.Settings, path);
    }
コード例 #5
0
    public static void BuildUpdate()
    {
        var path       = ContentUpdateScript.GetContentStateDataPath(false);
        var m_Settings = AddressableAssetSettingsDefaultObject.Settings;
        AddressablesPlayerBuildResult result = ContentUpdateScript.BuildContentUpdate(AddressableAssetSettingsDefaultObject.Settings, path);

        Debug.Log("BuildFinish path = " + m_Settings.RemoteCatalogBuildPath.GetValue(m_Settings));
    }
コード例 #6
0
        void OnUpdateBuild()
        {
            var path = ContentUpdateScript.GetContentStateDataPath(true);

            if (!string.IsNullOrEmpty(path))
            {
                ContentUpdateScript.BuildContentUpdate(AddressableAssetSettingsDefaultObject.Settings, path);
            }
        }
コード例 #7
0
        public override void Build(BuildTarget target,
                                   Model.NodeData node,
                                   IEnumerable <PerformGraph.AssetGroups> incoming,
                                   IEnumerable <Model.ConnectionData> connectionsToOutput,
                                   PerformGraph.Output Output,
                                   Action <Model.NodeData, string, float> progressFunc)
        {
            var updatePerformed = false;

            if (!string.IsNullOrEmpty(m_profileName) && m_profileName != kCurrentProfile)
            {
                Settings.activeProfileId = AddressableAssetSettingsDefaultObject.Settings.profileSettings.GetProfileId(m_profileName);
                //AddressableAssetSettingsDefaultObject.Settings.activeProfileId = AddressableAssetSettingsDefaultObject.Settings.profileSettings.GetProfileId(m_profileName);
            }

            if (m_preferUpdate)
            {
                if (string.IsNullOrEmpty(m_contentStateFilePath) || !File.Exists(m_contentStateFilePath))
                {
                    m_contentStateFilePath = ContentUpdateScript.GetContentStateDataPath(false);
                }

                if (!string.IsNullOrEmpty(m_contentStateFilePath) && File.Exists(m_contentStateFilePath))
                {
                    ContentUpdateScript.BuildContentUpdate(AddressableAssetSettingsDefaultObject.Settings, m_contentStateFilePath);
                    updatePerformed = true;
                }
            }

            if (!updatePerformed)
            {
                var index = Settings.DataBuilders.IndexOf(m_currentDataBuilder);

                AddressableAssetSettingsDefaultObject.Settings.ActivePlayerDataBuilderIndex = index;
                AddressableAssetSettings.BuildPlayerContent();
            }

            // AddressableBuilder does not add, filter or change structure of group, so just pass given group of assets
            if (Output != null)
            {
                var dst = (connectionsToOutput == null || !connectionsToOutput.Any())
                                        ? null
                                        : connectionsToOutput.First();

                if (incoming != null)
                {
                    foreach (var ag in incoming)
                    {
                        Output(dst, ag.assetGroups);
                    }
                }
                else
                {
                    Output(dst, new Dictionary <string, List <AssetReference> >());
                }
            }
        }
コード例 #8
0
    private static void PerformAddressablesContentUpdate()
    {
        string contentStateDataPath = ContentUpdateScript.GetContentStateDataPath(false);

        if (!File.Exists(contentStateDataPath))
        {
            throw new Exception("Previous Content State Data missing");
        }

        AddressableAssetSettings settings = AddressableAssetSettingsDefaultObject.Settings;

        ContentUpdateScript.BuildContentUpdate(settings, contentStateDataPath);
    }
コード例 #9
0
        private static void UpdateAddressablesBuild()
        {
            ExitCode code = ExitCode.UnknownError;

            BuildScript.buildCompleted += result =>
            {
                if (!string.IsNullOrEmpty(result.Error))
                {
                    code = ExitCode.AddressablesBuildFailed;
                }
                else
                {
                    code = ExitCode.Success;
                }
            };

            // find out what version we are updating

            string statePath = "Artifacts/addressables_content_state.bin";
            var    state     = ContentUpdateScript.LoadContentState(statePath);

            if (state != null)
            {
                Debug.Log("State file found, " + state.playerVersion);
            }
            code = state == null ? ExitCode.AddressablesContentFileNotFound : ExitCode.Success;

            List <AddressableAssetEntry> entries = ContentUpdateScript.GatherModifiedEntries(AddressableAssetSettingsDefaultObject.Settings, statePath);

            foreach (AddressableAssetEntry assetEntry in entries)
            {
                Debug.Log("Entry found to be moved - " + assetEntry.address);
            }
            Debug.Log("Creating update group");
            ContentUpdateScript.CreateContentUpdateGroup(AddressableAssetSettingsDefaultObject.Settings, entries, "Update Group");
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh(ImportAssetOptions.ForceSynchronousImport);
            ContentUpdateScript.BuildContentUpdate(AddressableAssetSettingsDefaultObject.Settings, statePath);

            // TODO edit catalog name.

            ExitOnError(code);
        }
コード例 #10
0
    public static void ShellBuild(string profile = "Default")
    {
        SetDataBuilder();
        var aaSettings = AddressableAssetSettingsDefaultObject.Settings;

        if (aaSettings != null && aaSettings.BuildRemoteCatalog)
        {
            var id = aaSettings.profileSettings.GetProfileId(profile);
            aaSettings.activeProfileId = id;
            string path = ContentUpdateScript.GetContentStateDataPath(false);
            if (File.Exists(path))
            {
                ContentUpdateScript.BuildContentUpdate(AddressableAssetSettingsDefaultObject.Settings, path);
            }
            else
            {
                AddressableAssetSettings.BuildPlayerContent();
            }
        }
    }
コード例 #11
0
    public override async Task <bool> Process(PipeContext context)
    {
        if (context == null)
        {
            throw new ArgumentNullException("context");
        }

        if (context.setting == null)
        {
            throw new System.ArgumentNullException("context.setting");
        }

        string stateAssetPath = context.setting.ConfigFolder;

        stateAssetPath = Path.Combine(stateAssetPath, PlatformMappingService.GetPlatform().ToString());
        var  content_state_path = Path.Combine(stateAssetPath, "addressables_content_state.bin");
        var  result             = ContentUpdateScript.BuildContentUpdate(context.setting, content_state_path);
        bool buildSuccess       = result != null && string.IsNullOrEmpty(result.Error);

        await Task.FromResult(true);

        return(buildSuccess);
    }
コード例 #12
0
 public static void BuildAssets()
 {
     ContentUpdateScript.BuildContentUpdate(AddressableAssetSettingsDefaultObject.Settings, ContentUpdateScript.GetContentStateDataPath(false));
     LaunchGameOnAndroid();
 }