Skip to content

Conversation

ryo0ka
Copy link
Contributor

@ryo0ka ryo0ka commented Sep 29, 2025

Changes

  • Passing buildProfile to -activeBuildProfile

Related Issues

Successful Workflow Run Link

Checklist

  • Read the contribution guide and accept the code of conduct
  • Docs (If new inputs or outputs have been added or changes to behavior that should be documented. Please make a PR
    in the documentation repo)
  • Readme (updated or not needed)
  • Tests (added, updated or not needed)

Impl details

  • Mac workflows failing due to an unrelated cause:
/Applications/Xcode_16.4.app/.../_stdio.h:318:7: error: expected identifier or '('
FILE    *fdopen(int, const char *) __DARWIN_ALIAS_STARTING(...);
...
/Applications/Unity/Hub/Editor/2022.3.13f1/Unity.app/Contents/il2cpp/external/zlib/zutil.h:147:33: note: expanded from macro 'fdopen'
#define fdopen(fd,mode) NULL /* No fdopen() */

AI analysis (not validated):

This happens because zlib's zutil.h defines fdopen as a macro, which conflicts with the standard library's fdopen declaration in the MacOS 15 SDK. This is a known compatibility issue when building Unity projects on newer MacOS SDKs and Xcode releases.

Workaround: Force Unity to use an older MacOS SDK (such as MacOS 13 or 14) and an Xcode version compatible with Unity 2022.3 LTS. Unity 2022.3.x may not yet support Xcode 16.4 and MacOS 15 SDK.

Since this is out of scope, I didn't investigate further.

  • Windows/Mac workflows don't include Unity 6000 + WebGL matrix, so the new path is only tested on Ubuntu workflows. Windows/Mac workflows only ensure backward compatibility with older Unity versions.
  • -activeTarget compatibility -- New implementation omits -activeTarget from Unity CLI args if buildProfile is passed to game-ci action. This aligns with Unity's behavior and is discussed in the linked issue. If user passed buildProfile to a project of older versions (2023-) by mistake, the build will likely fail.
  • Previous iteration (Support activeBuildProfile parameter #674) introduced a custom Unity CLI argument -customBuildProfile which is picked up in default-build-script to set the active build profile during build process. I assume that this is working around the -activeTarget compatibility issue. New implementation (with -activeBuildProfile official CLI argument) loads the build profile before the build script runs, so the custom argument is not used anymore. I've left it in the project for backward compatibility.
  • New implementation adds support for profile-specific define symbols, which is an official feature that allows to customize script compilation. I've added a symbol BUILD_PROFILE_LOADED to the existing profile in test-project, which is properly loaded to the build script in default-build-script, otherwise the integration test will fail.

Copy link

coderabbitai bot commented Sep 29, 2025

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (6)
  • dist/default-build-script/Assets/Editor/UnityBuilderAction/Builder.cs is excluded by !**/dist/**
  • dist/default-build-script/Assets/Editor/UnityBuilderAction/Input/ArgumentsParser.cs is excluded by !**/dist/**
  • dist/platforms/mac/steps/build.sh is excluded by !**/dist/**
  • dist/platforms/ubuntu/steps/build.sh is excluded by !**/dist/**
  • dist/platforms/windows/build.ps1 is excluded by !**/dist/**
  • test-project/Assets/Settings/Build Profiles/Sample WebGL Build Profile.asset is excluded by !**/*.asset

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

Cat Gif

dynamic buildPlayerOptions;

if (options["customBuildProfile"] != "") {
if (options.TryGetValue("activeBuildProfile", out var buildProfilePath) && !string.IsNullOrEmpty(buildProfilePath)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we go with a descriptive error, in case of null or empty?

Copy link
Contributor Author

@ryo0ka ryo0ka Sep 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commited a fix (mac/windows workflows cancelled)

$( [ -z "$BUILD_PROFILE" ] && echo "-buildTarget $BUILD_TARGET" ) \
-customBuildTarget "$BUILD_TARGET" \
-customBuildPath "$CUSTOM_BUILD_PATH" \
-customBuildProfile "$BUILD_PROFILE" \

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like customBuildProfile is no longer needed here (and other platforms).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's not needed/used anymore in default-build-script, but user could be picking it up in their own build script via -executeMethod. Example code of using the old argument exists in the previous iteration, which is public, so I decided to leave it there.

Copy link

codecov bot commented Sep 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 38.34%. Comparing base (c6c8236) to head (9262ee4).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #738   +/-   ##
=======================================
  Coverage   38.34%   38.34%           
=======================================
  Files          78       78           
  Lines        3169     3169           
  Branches      663      663           
=======================================
  Hits         1215     1215           
  Misses       1809     1809           
  Partials      145      145           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@webbertakken
Copy link
Member

@ryo0ka can you confirm this works? Is it in a mergeable state?

@ryo0ka
Copy link
Contributor Author

ryo0ka commented Sep 30, 2025

@webbertakken yes, I did run Ubuntu workflows on the latest commit and didn't see an error

@webbertakken webbertakken merged commit f7f3f70 into game-ci:main Sep 30, 2025
5 checks passed
@webbertakken
Copy link
Member

Released in v4.6.0

@somnisomni
Copy link

somnisomni commented Oct 1, 2025

Hello, I think this change seems break my automatic build pipeline. Build was successful before this change got merged.

Environment:

  • Running on GitHub Actions self-hosted runner (Windows)
  • Unity 6000.0.42f1

Workflow job definition:

- name: Build
        uses: game-ci/unity-builder@main
        env:
          UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
          UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
          UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
        with:
          versioning: None  # We have dedicated versioning pipeline in the source code
          runAsHostUser: true
          buildName: '[REDACTED]'
          buildProfile: 'Assets/06_Settings/Build Profiles/Windows Dev.asset'

Command line arguments according to actions log:

COMMAND LINE ARGUMENTS:
C:\UnityEditor\6000.0.42f1\Editor\Unity.exe
-quit
-batchmode
-nographics
-silent-crashes
-customBuildName
[REDACTED]
-projectPath
c:/github/workspace\.
-executeMethod
UnityBuilderAction.Builder.BuildProject
-customBuildTarget
StandaloneWindows64
-customBuildPath
c:/github/workspace\build/StandaloneWindows64\[REDACTED].exe
-customBuildProfile
Assets/06_Settings/Build Profiles/Windows Dev.asset
-buildVersion
none
-androidVersionCode
0
-androidKeystorePass
-androidKeyaliasName
-androidKeyaliasPass
-androidTargetSdkVersion
-androidExportType
androidPackage
-androidSymbolType
none
-logfile
-
-activeBuildProfile
Assets/06_Settings/Build
Profiles/Windows
Dev.asset

Key error message:

Unable to open the specified build profile 'Assets/06_Settings/Build'

Aborting batchmode due to failure:
Unable to open the specified build profile 'Assets/06_Settings/Build'

In command line arguments, the value of activeBuildProfile got 'splitted' for each whitespaces, making each splitted segments recognized as individual parameters. I think this is the key problem.
And yes, I can move the build profile file to somewhere without whitespaces in the path, but I don't think this is not an expected behavior so I'm reporting this.

@jonTabi
Copy link

jonTabi commented Oct 1, 2025

I ran into the bug. Unity's default folder path seems to be "Build Profiles" annoyingly.

Taking a quick look, my hunch is that the fix is to wrap the arguments in build.ps1, build.sh with the quotes as like the other variables, but I don't know much about shell/ps so someone else should confirm.

E.g.
$unityArgs += @("-activeBuildProfile", $Env:BUILD_PROFILE)
should be
$unityArgs += @("-activeBuildProfile", ""$Env:BUILD_PROFILE"")

"-buildTarget $BUILD_TARGET" is missing proper quotes around $BUILD_TARGET

@webbertakken
Copy link
Member

Ah yes, taking PRs for the quoting/escaping issue!

@webbertakken
Copy link
Member

@ryo0ka would you mind doing the follow-up PR?

@ryo0ka
Copy link
Contributor Author

ryo0ka commented Oct 2, 2025

@webbertakken this issue is because of this:

Windows/Mac workflows don't include Unity 6000 + WebGL matrix, so the new path is only tested on Ubuntu workflows. Windows/Mac workflows only ensure backward compatibility with older Unity versions.

I'll add Unity 6000+ paths to Windows/MacOS workflows which are currently missing. That should expose the quoting/escaping issue & I'll fix that too.

Regarding #741, it's due to me failing to update the document. @davidmfinol has dealt with it in #520.

@ryo0ka ryo0ka deleted the feat/active-build-profile branch October 3, 2025 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants