Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Correct way to build Addressables from code

Discussion in 'Addressables' started by joonturbo, Nov 19, 2020.

  1. joonturbo

    joonturbo

    Joined:
    Jun 24, 2013
    Posts:
    77
    I'm making build scripts and am trying to understand the correct order and functions.

    It seems that
    Code (CSharp):
    1.         AddressableAssetSettings.CleanPlayerContent();
    clears every platform. Is there a way to get it to clear only the current platform?

    Also it seems that
    Code (CSharp):
    1.         AddressableAssetSettings.BuildPlayerContent();
    only builds the current platform, which can only be set with
    Code (CSharp):
    1.         EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, BuildTarget.StandaloneOSX);
    2.  
    and that doesn't have any callbacks or oncompletes that I could find.

    What am I missing here?
    I'd like a step to clean, re-build the assetbundlles, and then build them for each platform, and then make Game builds for each platform.
     
  2. Redtail87

    Redtail87

    Joined:
    Jul 17, 2013
    Posts:
    125
    I'm not sure how to make that work specifically, but if you are using a build server, consider having a pipeline/job for each platform so you only have to worry about the active editor platforms in your scripts and don't have to take time switching between platforms for each full build.

    If you don't have a build server setup, running a local Jenkins server is not too difficult to setup.