Unity Build Automation ignores scripting defines from a Build Profile unless configured to use it. Commit the profile asset, set its project-relative path in the build configuration, then run a clean build.
Symptoms
- A scripting define symbol set in a Build Profile does not appear when building in Unity Build Automation.
- Code that depends on the define behaves as if the symbol is not defined.
- The same define symbol works correctly in local builds when using a Build Profile.
Cause
Unity Build Automation (UBA) was not configured to use the same Build Profile as the local environment. Without a profile path, UBA builds with the platform's standard settings, so defines that exist only in the Build Profile never apply. Note that Build Profiles are a Unity 6+ feature.
Resolution
- In the Unity Editor, confirm that the Build Profile includes the scripting define symbol.
- Locate the Build Profile asset (e.g., Assets/Settings/Build Profiles/YourBuildProfile.asset).
- Commit that .asset file to source control and push it to the branch used by UBA.
- In the Unity Dashboard, go to DevOps → Build Automation → Configurations.
- Edit the target's build configuration.
- In the "Basic info" section, set the Build Profile path to the exact relative path of the asset from the project root (e.g.,
Assets/Settings/Build Profiles/YourBuildProfile.asset). Do not use absolute paths. - Save the configuration and trigger a clean build so Unity runs with the -activeBuildProfile flag and applies the defines before compilation. A clean build (no library folder/cache) will ensure the new settings are applied properly.
More Information
To learn more about build profiles, please check out our documentation for an introduction on the topic.