Skip to content

Adds support for VisionOS in UnityHub in macos#710

Merged
webbertakken merged 4 commits intogame-ci:mainfrom
lupidan:feature/support-visionos
Jun 7, 2025
Merged

Adds support for VisionOS in UnityHub in macos#710
webbertakken merged 4 commits intogame-ci:mainfrom
lupidan:feature/support-visionos

Conversation

@lupidan
Copy link
Contributor

@lupidan lupidan commented Jun 7, 2025

Changes

  • Adds support for VisionOS as a BuildTarget
  • Adds support for VisionOS module in Unity Hub

Successful Workflow Run Link

From my personal plugin repository, here is a job, using my fork, that successfully export a VisionOS Xcodeproj
https://github.com/lupidan/apple-signin-unity/actions/runs/15509847075

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)

Summary by CodeRabbit

  • New Features
    • Added support for the VisionOS platform, including platform recognition and build handling.
    • VisionOS builds are now restricted to macOS systems.
    • Module parameters now include an option for VisionOS when targeting this platform.

@coderabbitai
Copy link

coderabbitai bot commented Jun 7, 2025

📝 Walkthrough

Walkthrough

The changes introduce support for the "VisionOS" platform. This includes adding "VisionOS" as a recognized platform type, updating image tag logic to handle a new "visionos" suffix with macOS build enforcement, and modifying macOS setup logic to append the appropriate module argument for VisionOS builds.

Changes

File(s) Change Summary
src/model/platform.ts Added "VisionOS" to the list of recognized platform types in the Platform class.
src/model/image-tag.ts Added "visionos" suffix support, enforced macOS-only builds for VisionOS, updated platform mapping.
src/model/platform-setup/setup-mac.ts Appended --module visionos argument for VisionOS platform in module parameter logic.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Platform
    participant ImageTag
    participant SetupMac

    User->>Platform: Request platform types
    Platform-->>User: Returns types including VisionOS

    User->>ImageTag: Request platform-to-suffix mapping for VisionOS
    ImageTag->>ImageTag: Check if process.platform === 'darwin'
    alt Not macOS
        ImageTag-->>User: Throw error (VisionOS builds require macOS)
    else macOS
        ImageTag-->>User: Return "visionos" suffix
    end

    User->>SetupMac: Request module params for VisionOS
    SetupMac-->>User: Append "--module visionos" to params
Loading

Possibly related PRs

  • Adds build support for tvOS in macos-latest #709: Both PRs modify the ImageTag class to enforce platform-specific build OS restrictions and update platform-to-suffix mappings for Apple-related platforms (tvOS in the retrieved PR and visionOS in the main PR), showing a direct relation in handling platform suffix logic and OS checks.

Suggested reviewers

  • webbertakken

Poem

A new horizon, VisionOS appears,
With suffix and checks, the logic now steers.
Only on Mac can this platform be born,
A module flag added, no more forlorn.
🥕 The code hops forward, with vision in sight,
Building for Apple’s new world feels just right!

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link

github-actions bot commented Jun 7, 2025

Cat Gif

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3b26780 and 43ff407.

⛔ Files ignored due to path filters (3)
  • dist/index.js is excluded by !**/dist/**
  • dist/index.js.map is excluded by !**/dist/**, !**/*.map
  • dist/licenses.txt is excluded by !**/dist/**
📒 Files selected for processing (3)
  • src/model/image-tag.ts (3 hunks)
  • src/model/platform-setup/setup-mac.ts (1 hunks)
  • src/model/platform.ts (1 hunks)
🔇 Additional comments (4)
src/model/platform.ts (1)

19-19: LGTM! Clean platform type addition.

The VisionOS platform type is correctly added following the established naming convention and logical placement among Apple platforms.

src/model/platform-setup/setup-mac.ts (1)

106-108:

Details

✅ Verification successful

LGTM! Consistent module parameter implementation.

The VisionOS module parameter follows the established pattern with lowercase naming convention, consistent with other Apple platforms (ios, tvos).

Verify that Unity Hub uses 'visionos' as the module identifier:


🌐 Web query:

What is the correct Unity Hub module identifier for VisionOS platform support?

💡 Result:

To develop applications for Apple's visionOS platform using Unity, you need to install the visionOS module through Unity Hub. This module is available for Unity Editor versions 2022.3.5f1 and later. (docs.unity3d.com)

To install the visionOS module:

  1. Open Unity Hub.
  2. Navigate to the 'Installs' tab.
  3. Click on the three dots next to your desired Unity Editor version and select 'Add Modules'.
  4. In the list of available modules, check the box for 'visionOS Build Support'.
  5. Click 'Done' to begin the installation.

Once installed, you can create or configure projects for visionOS by selecting the 'visionOS' platform in the Build Settings. For more detailed instructions, refer to Unity's official documentation on visionOS. (docs.unity3d.com)

Citations:


Approved: Verified Unity Hub module identifier ‘visionos’

Confirmed via Unity’s documentation that the VisionOS build-support module is identified as “visionos” (shown in the Hub UI as “visionOS Build Support”), matching the lowercase pattern used for other Apple platforms. No further changes needed.

src/model/image-tag.ts (2)

61-61: LGTM! Proper suffix addition.

The visionos suffix follows the established lowercase naming convention consistent with other Apple platforms.


86-100: LGTM! Necessary destructuring update.

The destructuring properly includes the new visionos suffix for use in the platform mapping logic.

Comment on lines +158 to +163
case Platform.types.VisionOS:
if (process.platform !== 'darwin') {
throw new Error(`visionOS can only be built on a macOS base OS`);
}

return visionos;
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

LGTM! Correct platform validation for VisionOS.

The implementation properly enforces macOS-only builds for VisionOS using process.platform === 'darwin', which is appropriate for Apple's visionOS platform. The error message is clear and informative.

Note: There appears to be an inconsistency in the existing tvOS validation logic (lines 152-157) where it checks !== 'win32' but claims tvOS can only be built on Windows. This seems like a pre-existing issue unrelated to your changes, but you may want to verify the correct platform requirements for tvOS builds.


🌐 Web query:

What are the correct platform requirements for building tvOS applications in Unity? Can tvOS be built on Windows or does it require macOS like other Apple platforms?

💡 Result:

To build tvOS applications in Unity, you need to consider the platform requirements:

  1. Development Platform:

    • While you can develop your Unity project on Windows, you cannot build the final tvOS application entirely on Windows.
    • tvOS development requires Xcode for the final build and signing process. Xcode is only available on macOS.
  2. Building and Deployment:

    • You must use a macOS machine to build the tvOS application from Unity.
    • The process typically involves exporting your Unity project to an Xcode project and then using Xcode to compile, sign, and deploy the app to a tvOS device or the Apple TV simulator.
  3. Unity Support:

    • Unity supports tvOS as a build target, but the build process integrates with Xcode, which enforces the need for macOS.

Summary:

  • You can develop and do much of the work on Windows.
  • You must have access to macOS with Xcode installed to build, sign, and submit tvOS applications.

This is similar to other Apple platforms (iOS, macOS, watchOS) which also require macOS for final building and submission through Xcode.


Fix tvOS platform validation

The VisionOS check on lines 158–163 is correct, but the existing tvOS logic still enforces Windows-only builds. Unity tvOS targets also require Xcode on macOS and cannot be fully built on Windows.

Please update src/model/image-tag.ts around lines 152–157:

  • Change the tvOS platform guard to check for process.platform !== 'darwin'
  • Update the error message to reflect macOS requirement

Suggested diff:

 case Platform.types.TVOS:
-  if (process.platform !== 'win32') {
-    throw new Error(`tvOS can only be built on Windows`);
-  }
+  if (process.platform !== 'darwin') {
+    throw new Error(`tvOS can only be built on a macOS base OS`);
+  }
   return tvos;

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/model/image-tag.ts around lines 152 to 157, the tvOS platform validation
incorrectly checks for Windows platform and restricts builds to Windows, but
tvOS builds require macOS with Xcode. Update the condition to check if
process.platform is not 'darwin' and change the error message to indicate that
tvOS can only be built on a macOS base OS, aligning it with the VisionOS
validation logic.

Copy link
Member

@webbertakken webbertakken left a comment

Choose a reason for hiding this comment

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

LGTM

@codecov
Copy link

codecov bot commented Jun 7, 2025

Codecov Report

Attention: Patch coverage is 20.00000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 37.07%. Comparing base (3b26780) to head (0218620).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/model/image-tag.ts 20.00% 4 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #710      +/-   ##
==========================================
- Coverage   37.12%   37.07%   -0.05%     
==========================================
  Files          77       77              
  Lines        3157     3161       +4     
  Branches      623      625       +2     
==========================================
  Hits         1172     1172              
- Misses       1985     1989       +4     
Files with missing lines Coverage Δ
src/model/platform.ts 100.00% <ø> (ø)
src/model/image-tag.ts 47.36% <20.00%> (-2.09%) ⬇️
🚀 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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/model/image-tag.ts (1)

158-163: LGTM! Proper platform validation for VisionOS with test coverage gap.

The implementation correctly enforces macOS-only builds for VisionOS using process.platform === 'darwin', which aligns with Apple platform requirements. The error message is clear and informative.

However, the static analysis indicates these lines lack test coverage. Consider adding unit tests to validate:

  • VisionOS builds succeed on macOS (process.platform === 'darwin')
  • VisionOS builds fail with appropriate error on non-macOS platforms
  • Correct return value (visionos suffix)
// Example test case structure:
describe('VisionOS platform validation', () => {
  it('should allow VisionOS builds on macOS', () => {
    // Test logic here
  });
  
  it('should reject VisionOS builds on non-macOS platforms', () => {
    // Test logic here
  });
});
🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 158-158: src/model/image-tag.ts#L158
Added line #L158 was not covered by tests


[warning] 160-160: src/model/image-tag.ts#L160
Added line #L160 was not covered by tests


[warning] 163-163: src/model/image-tag.ts#L163
Added line #L163 was not covered by tests

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 43ff407 and 0218620.

⛔ Files ignored due to path filters (2)
  • dist/index.js is excluded by !**/dist/**
  • dist/index.js.map is excluded by !**/dist/**, !**/*.map
📒 Files selected for processing (2)
  • src/model/image-tag.ts (3 hunks)
  • src/model/platform-setup/setup-mac.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/model/platform-setup/setup-mac.ts
🧰 Additional context used
🪛 GitHub Check: codecov/patch
src/model/image-tag.ts

[warning] 158-158: src/model/image-tag.ts#L158
Added line #L158 was not covered by tests


[warning] 160-160: src/model/image-tag.ts#L160
Added line #L160 was not covered by tests


[warning] 163-163: src/model/image-tag.ts#L163
Added line #L163 was not covered by tests

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Tests
🔇 Additional comments (2)
src/model/image-tag.ts (2)

61-61: LGTM! Correct suffix mapping for VisionOS.

The visionos suffix is properly added to the target platform suffixes, maintaining consistency with other Apple platforms.


86-100: LGTM! Destructuring assignment updated correctly.

The addition of visionos to the destructuring assignment maintains consistency with the expanded targetPlatformSuffixes object.

@webbertakken webbertakken merged commit a1ebdb7 into game-ci:main Jun 7, 2025
5 checks passed
@webbertakken
Copy link
Member

Released in v4.6.0

@lupidan lupidan deleted the feature/support-visionos branch October 20, 2025 21:33
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.

2 participants