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

How to set Profile during build time (programatically)?

Discussion in 'Addressables' started by bruno_1308, May 8, 2019.

  1. bruno_1308

    bruno_1308

    Joined:
    May 16, 2018
    Posts:
    14
    Hello all,
    I have several profiles created (Develop, Staging, Production), each of them pointing to different URL's to where they should download remote assets from during runtime.
    During my build, I want to be able to set the profile programatically, so that I won't have to manually switch my profile before our CI/CD system makes a build of the game.
     
  2. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    You can do something like
    settings.profileSettings.GetAllProfileNames() to get the list of names if you need it, and you can set the current one with something like

    AddressableAssetSettingsDefaultObject.Settings.activeProfileId = AddressableAssetSettingsDefaultObject.Settings.profileSettings.GetProfileId("production");
     
    bruno_1308 likes this.
  3. bruno_1308

    bruno_1308

    Joined:
    May 16, 2018
    Posts:
    14
    unity_bill likes this.