GithubHelp home page GithubHelp logo

Comments (3)

celojevic avatar celojevic commented on May 28, 2024

You need to build addressables along with every build. I just made a script with it that you need to add to the Post-Build actions in the SUB window:

image

using SuperUnityBuild.BuildTool;

using System;

using UnityEditor;
using UnityEditor.AddressableAssets.Settings;
using UnityEditor.AddressableAssets;
using UnityEditor.AddressableAssets.Build;
using UnityEditor.Build.Pipeline.Utilities;

using UnityEngine;

namespace SuperUnityBuild.BuildActions
{

    public class UploadAddressablePostBuild : BuildAction, IPostBuildPerPlatformAction
    {

        [Tooltip("True to upload the built addressables to your CCD. You must have this already set up.")]
        [SerializeField] private bool _uploadToCcd=true;

        public override void PerBuildExecute(BuildReleaseType releaseType, BuildPlatform platform, 
            BuildArchitecture architecture, BuildScriptingBackend scriptingBackend, 
            BuildDistribution distribution, DateTime buildTime, ref BuildOptions options, 
            string configKey, string buildPath)
        {
            var settings = AddressableAssetSettingsDefaultObject.Settings;

            // NOTE: you need to modify this to fit your addressable profile names
            string profileName = platform.platformName == "PC" ? "Windows" : platform.platformName;
            // set the active profile based on platform
            string profileId = settings.profileSettings.GetProfileId(profileName);
            settings.activeProfileId = profileId;
            Debug.Log($"Setting active profile with name '{profileName}' to ID: " + settings.activeProfileId);

            // addressables is currently bugged, so we have to clear the cache before building
            // otherwise it'll get stuck in a dependency loop
            var activeBuilder = settings.ActivePlayerDataBuilder;
            AddressableAssetSettings.CleanPlayerContent(activeBuilder);
            BuildCache.PurgeCache(false);
            Caching.ClearCache();

            // this will build your addressables based on your profile settings
            AddressableAssetSettings.BuildPlayerContent(out AddressablesPlayerBuildResult result);
            Debug.Log("Err: " + result.Error);

            // this will upload the addressables to your CCD if true
            if (_uploadToCcd)
            {
                var builderInput = new AddressablesDataBuilderInput(settings);
                var task = CcdBuildEvents.Instance.UploadAndRelease(builderInput, result);
                task.ContinueWith(t =>
                {
                    Debug.Log("Upload and release succeeded: " + t.Result);
                });
            }
        }

    }

}

from buildactions.

MadhurG-Hexaware avatar MadhurG-Hexaware commented on May 28, 2024

@celojevic can you provide script "CcdBuildEvents" as it is referenced in above script or any other generic way to upload stuff?

from buildactions.

celojevic avatar celojevic commented on May 28, 2024

@celojevic can you provide script "CcdBuildEvents" as it is referenced in above script or any other generic way to upload stuff?

That script is part of the unity CCD management package

from buildactions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.