8000 PolySpatial dependency prevents compilation for native Metal visionOS builds · Issue #76 · apple/unityplugins · GitHub
[go: up one dir, main page]

Skip to content

PolySpatial dependency prevents compilation for native Metal visionOS builds #76

@sambam60

Description

@sambam60

Description
The com.apple.unityplugin.spatialcontroller package has a hard dependency on Unity.PolySpatial which causes compilation errors when building native Metal visionOS apps without PolySpatial installed.
(This bug was found and fixed by me during the Developer Lab in London)

To Reproduce
Steps:
Create a new Unity 6 project (6000.3.x) targeting visionOS
Configure for native Metal rendering (NOT using PolySpatial/RealityKit)
Install com.apple.unityplugin.spatialcontroller package from the unityplugins repository
Attempt to compile the project
Observe compilation error: error CS0234: The type or namespace name 'PolySpatial' does not exist in the namespace 'Unity'

Expected behavior
The SpatialController package should compile successfully without requiring PolySpatial, since PolySpatial is only needed for Unity's RealityKit conversion layer and is not required for native Metal visionOS development. The VolumeCamera bounded mode check is only used for a warning message and should be optional.
Screenshots

N/A - compilation error in console, won't compile with IL2CPP

Desktop:
Device: M2 MacBook Air, 2023
OS: macOS Tahoe 26.0.1
Unity Version: 6000.3.1f1
Xcode Version: 16.x
visionOS SDK: 2.x

Additional context
Files affected:
Apple/Scripts/apple.accessorytracking.asmdef - Line 8 references "Unity.PolySpatial" as a required assembly
Apple/Scripts/AccessoryTrackingHelper.cs - Line 14 imports Unity.PolySpatial for VolumeCamera class usage

Suggested fix:
Remove Unity.PolySpatial from the asmdef references array
Add a versionDefines entry to define UNITY_POLYSPATIAL when the package is present
Wrap the VolumeCamera code in AccessoryTrackingHelper.cs with #if UNITY_POLYSPATIAL conditional compilation
This allows the package to work with both PolySpatial-based projects and native Metal visionOS projects. I have got PSVR2 Controllers

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0