Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Build addressable bundles when clicking the build button
/// <summary>
/// The script gives you choice to whether to build addressable bundles when clicking the build button.
/// For custom build script, call PreExport method yourself.
/// For cloud build, put BuildAddressablesProcessor.PreExport as PreExport command.
/// Discussion:
/// </summary>
using UnityEditor;
using UnityEditor.AddressableAssets;
using UnityEditor.AddressableAssets.Settings;
using UnityEngine;
using System.Collections;
class BuildAddressablesProcessor
/// <summary>
/// Run a clean build before export.
/// </summary>
static public void PreExport()
Debug.Log("BuildAddressablesProcessor.PreExport start");
Debug.Log("BuildAddressablesProcessor.PreExport done");
private static void Initialize()
private static void BuildPlayerHandler(BuildPlayerOptions options)
if (EditorUtility.DisplayDialog("Build with Addressables",
"Do you want to build a clean addressables before export?",
"Build with Addressables", "Skip"))

This comment has been minimized.

Copy link
Owner Author

@favoyang favoyang commented Sep 5, 2019

Unity officially supports build addressables in cloud build except for WebGL target. However the script can be still useful to trigger build addressables locally with app build (GUI only).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.