Search Issue Tracker

Fixed

Fixed in 6000.0.38f1, 6000.1.0b3, 7000.0.0a20

Votes

4

Found in

6000.0.36f1

6000.1.0a9

6000.2.0a1

7000.0.0a20

Issue ID

UUM-91151

Regression

Yes

GetActiveBuildProfile can only be called from the main thread crash and error when switching from Windows to Android

-

{}Steps to reproduce:{}{}{}

  1. Create a new project with URP Sample > com.unity.template.urp-sample.
  2. Once the project opens, open Build Profile window.
  3. Create a new Android Profile.
  4. Switch to the new Profile.

Actual results: We get a console error and unity crash after script recompile
{code:java}
UnityException: GetActiveBuildProfile can only be called from the main thread. Constructors and field initializers will be executed from the loading thread when loading a scene.{code}
Expected results: Editor does not crash or throws errors after restart.

Reproducible with versions: 6000.1.0a9

Not reproducible with versions: 6000.0.26f1,  6000.0.29f1

{}Tested on (OS):{}{}{}

  • macOS (Does not repro) 
  • Windows 

{}Notes:{}{}{}

  1. Resolution Note (fix version 6000.1.0b3):

    Tested 4 times and did not repro with 6000.1.0b3

  2. Resolution Note (fix version 6000.0.38f1):

    Verified 6000.0.38f1, switching between windows and android URP did not crash

Comments (7)

  1. gekidoslayer

    Oct 01, 2025 17:11

    This isn't fixed, still happens constantly in Unity 6.0.34f1 when you set your editor to Android / Vulkan

  2. unity_B308D4B86FEC581D3307

    Sep 29, 2025 13:51

    I spent the entire day trying to solve this.
    For me the issue seemed to have stemmed from a script using Unity.VisualScripting although there were no actual functions that needed it, at least anymore. Removing the line got rid of the error occurring.

    I'm a novice so I can't say this is the root issue, but checking through your packages and making sure there's no internal code that's trying to access the build profile may be the key for anyone who stumbles upon this error!

  3. muhammadadnan0075

    Feb 10, 2025 07:50

    Have been getting it constantly since all the LTS 6000 versions
    Goes away if switch from Android to Windows but switching back to android spams it back

  4. prukop

    Jan 19, 2025 22:08

    Getting this on 6000.0.33f1 on Windows after creating an Android build profile.
    Seems to happen under several conditions, but very consistent when I edit and save a ShaderGraph, I get this error and stacktrace:

    ```
    UnityException: GetActiveBuildProfile can only be called from the main thread.
    Constructors and field initializers will be executed from the loading thread when loading a scene.
    Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
    UnityEditor.EditorUserBuildSettings.GetActiveBuildProfile () (at <18226ebcc7724db583d19c0aeb6444e9>:0)
    UnityEditor.EditorUserBuildSettings.get_activeBuildProfile () (at <18226ebcc7724db583d19c0aeb6444e9>:0)
    UnityEditor.Build.Profile.BuildProfileContext.get_activeProfile () (at <18226ebcc7724db583d19c0aeb6444e9>:0)
    UnityEditor.Build.Profile.BuildProfileContext.ShouldReturnActiveProfile (UnityEditor.BuildTarget buildTarget, UnityEditor.StandaloneBuildSubtarget subtarget, System.String sharedSetting) (at <18226ebcc7724db583d19c0aeb6444e9>:0)
    UnityEditor.Build.Profile.BuildProfileContext.GetActiveOrClassicBuildProfile (UnityEditor.BuildTarget target, UnityEditor.StandaloneBuildSubtarget subTarget, System.String sharedSetting) (at <18226ebcc7724db583d19c0aeb6444e9>:0)
    ```

    Have tried removing/recreating the build profile, error still occurs.

  5. corriedotdev

    Jan 09, 2025 19:24

    Replicating same issue on 6000.0.32f1 - Initially corrupted entire project. Change made before crash was adding a new video to a render texture.

  6. jpq

    Jan 08, 2025 16:47

    error occurs on 6000.0.30f1 too

  7. LePaithon

    Dec 26, 2024 13:17

    Getting this on 6000.0.23f1. Any time i open the unity project (android), I get spammed with this error in my console.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.