Skip to content

Conversation

@from2001
Copy link
Collaborator

This pull request refactors the way passthrough mode and XR mode switching are managed in the XR rig codebase, improving encapsulation and making the PassthroughManager methods and properties internal. The main logic for passthrough mode is now accessed through the StylyXrRig class, which delegates to its internal PassthroughManager instance. This change enhances the clarity of the public API and restricts direct access to passthrough controls.

Encapsulation and API changes:

  • Made PassthroughManager.PassthroughMode property and SwitchToVR/SwitchToMR methods internal, restricting their access to within the assembly. [1] [2]

Delegation and initialization:

  • Added a private PassthroughManager field to StylyXrRig and initialized it in Awake using GetComponentInChildren. [1] [2]
  • Updated StylyXrRig to expose public PassthroughMode property and SwitchToVR/SwitchToMR methods, which delegate to the internal PassthroughManager if available.

Minor cleanup:

  • Removed an unused variable declaration in StylyXrRig for cleaner code.

Close #120

@from2001 from2001 requested a review from Copilot September 27, 2025 03:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request refactors the XR rig codebase to improve encapsulation by moving passthrough mode controls from direct PassthroughManager access to delegation through StylyXrRig. The changes make PassthroughManager methods and properties internal while providing public access through StylyXrRig.

  • Made PassthroughManager methods and properties internal to restrict assembly access
  • Added delegation layer in StylyXrRig to provide public API for passthrough controls
  • Updated component initialization to use GetComponentInChildren instead of FindFirstObjectByType

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
StylyXrRig.cs Added passthrough delegation methods and private field, updated component lookup
PassthroughManager.cs Changed public methods and properties to internal visibility

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@from2001 from2001 merged commit f45f059 into develop Sep 27, 2025
@from2001 from2001 deleted the refactor/passthrough-public-api branch September 27, 2025 03:48
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.

SwitchToMR() method should be used via StylyXrRig.cs

2 participants