Unity 6000.0.0f1 - BuildProfile API not available?

I’m trying to use BuildProfiles so I can have 2 WebGL builds using different settings. Various parts of the BuildProfile API such as Unity - Scripting API: Build.Profile.BuildProfile.SetActiveBuildProfile (unity3d.com) don’t seem to actually be available?

Am I missing something, or is the documentation wrong? because this would be really useful to me right now.

Is available for me.

Did you import the UnityEditor.Build.Profile namespace?

Yes I did.

using UnityEditor;
using UnityEditor.Build.Profile;

public class BuildProfileTest {
   public static void Test() {
        UnityEditor.Build.Profile.BuildProfile.SetActiveBuildProfile("test");
    }
}

I actually get an error saying that BuildProfile is not accessible because it’s an internal class. Looking at its definition I don’t even see SetActiveBuildProfile there.

// Decompiled with JetBrains decompiler
// Type: UnityEditor.Build.Profile.BuildProfile
// Assembly: UnityEditor.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: F8883EED-704F-4009-B596-970FA5ED9BE9
// Assembly location: C:\Program Files\Unity\Hub\Editor\2023.3.0b4\Editor\Data\Managed\UnityEngine\UnityEditor.CoreModule.dll
// XML documentation location: C:\Program Files\Unity\Hub\Editor\2023.3.0b4\Editor\Data\Managed\UnityEngine\UnityEditor.CoreModule.xml

using JetBrains.Annotations;
using System;
using System.Runtime.InteropServices;
using UnityEditor.Modules;
using UnityEngine;
using UnityEngine.Bindings;
using UnityEngine.Scripting;

#nullable disable
namespace UnityEditor.Build.Profile
{
  [RequiredByNativeCode(GenerateProxy = true)]
  [VisibleToOtherModules]
  [StructLayout(LayoutKind.Sequential)]
  internal sealed class BuildProfile : ScriptableObject
  {

The decompile shows you’re still using an old beta version (2023.3.0b4), the API was probably made public at a later point.

1 Like

I noticed that too right after posting! That’s really odd because I have the project open in 6000.0.0f1. I’ll have to clean out the project folder entirely and see what happens.

Deleting the old versions of 2023 and Unity 6 that I had installed seems to have fixed the issue and made the API available. So something seems a little broken in the install process for 6 maybe?