Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

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

    Unity Technologies

    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.