-
Notifications
You must be signed in to change notification settings - Fork 2
Refactor/sdk setup #103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor/sdk setup #103
Conversation
| PrepareSdkInstallation(); | ||
| if (AddUnityPackage(packageIdentifier)) { SessionState.SetBool(packageIdentifier, true); } | ||
| // Install package and assign loader | ||
| if (InstallPackageAndAssignLoaderForBuildTarget("com.unity.xr.visionos", "UnityEngine.XR.VisionOS.VisionOSLoader", BuildTargetGroup.VisionOS)) { SessionState.SetBool(packageIdentifier, true); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"com.unity.xr.visionos" and packageIdentifier are the same.
| void Step1() // Enable the OpenXR Loader | ||
| { | ||
| EnableXRPlugin(BuildTargetGroup.Standalone, typeof(OpenXRLoader)); | ||
| EnableXRPlugin(BuildTargetGroup.Android, "UnityEngine.XR.OpenXR.OpenXRLoader"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PCVR is standalone. Why the change to Android?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’s just a mistake. I’ll fix it.
|
I fixed the wrong code in #104 |
Key changes
New logic for visionOS uses InstallPackageAndAssignLoaderForBuildTarget instead of EnableXRPlugin.
Details
This pull request refactors and streamlines the SDK setup logic for various XR platforms in the Styly XR Rig project. The main focus is on improving package installation and loader assignment, unifying the way XR plugins are enabled, and cleaning up unused code. Special handling is also introduced for VisionOS, reflecting its unique requirements.
SDK Setup Refactoring and Unification:
Replaced usage of
typeof(OpenXRLoader)with the string"UnityEngine.XR.OpenXR.OpenXRLoader"in allEnableXRPlugincalls, ensuring a consistent approach to enabling XR plugins across all SDK setup scripts. (SetupSdk_AndroidXR.cs,SetupSdk_MetaOpenXrSdk.cs,SetupSdk_PicoUnityOpenXrSdk.cs,SetupSdk_Template.cs,SetupSdk_ViveOpenXrPlugin.cs,SetupSdk_PcVrForDevelopment.cs) [1] [2] [3] [4] [5] [6]Removed the call to
PrepareSdkInstallation()from allInstallPackage()methods, simplifying the package installation process. (SetupSdk_AndroidXR.cs,SetupSdk_MetaOpenXrSdk.cs,SetupSdk_PicoUnityOpenXrSdk.cs,SetupSdk_Template.cs,SetupSdk_ViveOpenXrPlugin.cs,SetupSdk_PcVrForDevelopment.cs,SetupSdk_XrealSdk.cs) [1] [2] [3] [4] [5] [6] [7]VisionOS-Specific Adjustments:
"com.unity.xr.visionos"and updatedInstallPackage()to use the newInstallPackageAndAssignLoaderForBuildTargetmethod, which handles both package installation and loader assignment in one step. Also clarified that VisionOS setup differs from other SDKs and removed unnecessary code from the loader enabling step. (SetupSdk_PolySpatialVisionOS.cs) [1] [2]Core Utility Enhancements:
PrepareSdkInstallation()with a newInstallPackageAndAssignLoaderForBuildTargetmethod inSetupSdkUtils.cs, using reflection to call Unity's internal API for installing packages and assigning loaders in one atomic operation. This improves reliability and maintainability of the SDK setup process. (SetupSdkUtils.cs)Code Cleanup:
Removed the now-unused
SetupSdk.csfile and its associated.metafile, as well as the related menu item for removing all SDK packages. (SetupSdk.cs,SetupSdk.cs.meta,SetupSdkMenu.cs) [1] [2] [3]Minor import and code organization improvements, such as removing unused
UnityEditor.Renderingimport and adjusting debug menu items. (SetupSdkUtils.cs,SetupSdkMenu.cs) [1] [2]