Addressable Settings in Editor Script

Hey there, I have been looking everywhere and I cannot find anything to help me with this problem. I have an editor script that changes a lot of elements in my project between a release mode and a dev mode so that development tests do not interfere with live users. I am trying to include in this editor script a change before build from one profile to another in Addressable Asset Settings.

The setting is on the Addressable Asset Settings scriptable object under profiles. It is very easy to click Profile In Use and change it to a different one but I would really like to consolidate every change needed for different build types into one spot. So I need to change the currently selected Profile In Use in C# using an editor script.

m_AssetSettings.activeProfileId = “DevMode”; doesn’t seem to do anything when run in the editor

Thanks in advance for any help, it would be much appreciated.

Setting an active profile is not done using its name, but by using the ID of a profile. If you check out the Addressable Asset Settings object in the debug inspector, you can see the ID associated with the name.

You can switch the active profile based on the name using this snippet:

AddressableAssetSettings settings = AddressableAssetSettingsDefaultObject.Settings;
AddressableAssetProfileSettings profile = settings.profileSettings;
string profileID = settings.profileSettings.GetProfileId(profileName);
settings.activeProfileId = profileID;

Hope that helps!

Thanks this is what I ended up doing!