Skip to content

Commit a7e7b81

Browse files
Android XR Unity Extensions v1.1.0
1 parent d4453a4 commit a7e7b81

23 files changed

+368
-231
lines changed

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,37 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
88
and this package adheres to
99
[Semantic Versioning](http://semver.org/spec/v2.0.0.html).
1010

11+
## [1.1.0] - 2025-06-27
12+
13+
### Editor version and package compatibility
14+
15+
* This version of the package requires minimal Unity Editor version `6000.1.0b12`. You can install the official **Unity 6.1** (e.g. `6000.1.0f1` or newer) from the Unity Hub.
16+
* Verified compatible packages:
17+
* Unity OpenXR Android XR (`com.unity.xr.androidxr-openxr`) 1.0.0-pre.3
18+
19+
### Known issues
20+
* None
21+
22+
### Added
23+
* None
24+
25+
### Changed
26+
* **Subsampling (Vulkan)** is now enabled by default in **Android XR (Extensions): Session Management**. To use it at runtime:
27+
* Foveation feature is required for **Subsampling (Vulkan)**. Otherwise, the application may result in rendering faulty.
28+
* For projects with Universal Render Pipeline (URP), select **Foveated Rendering** featurem. Check [Foveated rendering in OpenXR](https://docs.unity3d.com/Packages/[email protected]/manual/features/foveatedrendering.html) for more details.
29+
* For projects with Built-in Render Pipeline (BiRP), select **Foveation (Legacy)** feature for legacy support.
30+
* **Scene Meshing** is promoted from experimental feature to release feature.
31+
32+
### Deprecated
33+
* None
34+
35+
### Removed
36+
* None
37+
38+
### Fixed
39+
* Fixed [issue#7](https://github.com/android/android-xr-unity-package/issues/7): Compile Errors with Google.XR.Extensions on Non-Android Platforms.
40+
* Fixed enum value and comments in `XRFaceParameterIndices`.
41+
1142
## [1.0.0] - 2025-05-07
1243

1344
### Editor version and package compatibility

Editor/Internal/XRSessionFeatureBuildHooks.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -350,15 +350,11 @@ private bool CheckExperimentalPermission()
350350
XRBodyTrackingFeature bodyTracking =
351351
AndroidXRBuildUtils.GetActiveFeature<XRBodyTrackingFeature>();
352352
bodyTrackingInUse = bodyTracking != null && bodyTracking.enabled;
353-
bool sceneMeshingInUse = false;
354-
XRSceneMeshingFeature sceneMeshing =
355-
AndroidXRBuildUtils.GetActiveFeature<XRSceneMeshingFeature>();
356-
sceneMeshingInUse = sceneMeshing != null && sceneMeshing.enabled;
357353
bool systemStateInUse = false;
358354
XRSystemStateFeature systemState =
359355
AndroidXRBuildUtils.GetActiveFeature<XRSystemStateFeature>();
360356
systemStateInUse = systemState != null && systemState.enabled;
361-
return bodyTrackingInUse || sceneMeshingInUse || systemStateInUse;
357+
return bodyTrackingInUse || systemStateInUse;
362358
}
363359
}
364360
}

Editor/Internal/XRSessionFeatureEditor.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ internal class XRSessionFeatureEditor : Editor
3636
private const string _subsamplingFieldName = "_vulkanSubsampling";
3737
private const string _subsamplingTooltip =
3838
"Enable Subsampling (Vulkan) to reduce memory bandwidth on foveated framebuffers. " +
39-
"It only takes effect when Foveated Rendering feature is in use.";
39+
"This requires the <b>Foveated Rendering</b> feature to be enabled or " +
40+
"<b>Foveation (Legacy)</b> for legacy support. " +
41+
"Otherwise, the application will result in rendering faulty.";
4042

4143
private const string _spacewarpFieldName = "_spacewarp";
4244
private const string _spacewarpTooltip =

README.md

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@
22

33
The Android XR Extensions for Unity provide APIs for the following:
44

5-
1. Anchor.
6-
2. Object Tracking.
7-
3. Passthrough Composition Layer.
8-
4. Plane.
9-
5. Session Management.
10-
6. Face Tracking.
11-
7. Unbounded Reference Space.
12-
8. Environment Blend Mode.
13-
9. Foveation (Legacy).
14-
10. Mouse Interaction Profile.
5+
1. Session Management: required for all Android XR Extensions' features.
6+
2. Environment Blend Mode.
7+
3. Object Tracking.
8+
4. Face Tracking.
9+
5. Marker Tracking.
10+
6. QR Code Tracking.
11+
7. Hand Mesh.
12+
8. Scene Meshing.
13+
9. Unbounded Reference Space.
14+
10. Passthrough Composition Layer.
15+
11. Mouse Interaction Profile.
16+
12. Body Tracking *(Experimental)*.
17+
13. System State *(Experimental)*.
1518

1619
## How to use
1720

@@ -22,8 +25,11 @@ The Android XR Extensions for Unity provide APIs for the following:
2225
then check **OpenXR** as the plug-in provider at OpenXR runtime.
2326
3. Under **XR Plug-in Management > OpenXR**, switch to **Android** tab, select
2427
**Android XR (Extensions)** feature group, or select individual features
25-
that your want to use at OpenXR runtime. Some of them might be incompatible
26-
with another, refer to the *README.md* from each sample for more details.
28+
that your want to use at OpenXR runtime.
29+
30+
NOTE: Some of them might have additional requirements or configuration,
31+
refer to the *README.md* from each sample for more details.
32+
2733
4. Under **XR Plug-in Management > Project Validation**, fix all **OpenXR**
2834
related issues. This will help to configure your **Player Settings**.
2935
5. In **Player > Android > Identification > Minimal API Level**, select 24 or

Runtime/AndroidXRRuntimeImageLibrary.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace Google.XR.Extensions
2727

2828
/// <summary>
2929
/// Constructs a <see cref="RuntimeReferenceImageLibrary"/> which stores reference images
30-
/// for QR Code trackng at Android XR devices.
30+
/// for Marker Tracking and QR Code trackng at Android XR devices.
3131
/// </summary>
3232
[SuppressMessage(
3333
"UnityRules.UnityStyleRules", "US1109:PublicPropertiesMustBeUpperCamelCase",
@@ -235,9 +235,9 @@ public static void ValidateMarker(IReferenceImageLibrary imageLibrary)
235235
#endif // UNITY_EDITOR
236236

237237
/// <summary>
238-
/// Determine if the given refernce image is a QR code reference.
238+
/// Determine if the given reference image is a QR code reference.
239239
/// </summary>
240-
/// <param name="image">The refernce image with QR code name.</param>
240+
/// <param name="image">The reference image with QR code name.</param>
241241
/// <returns>
242242
/// <c>true</c>, if it's a valid QR code reference.
243243
/// </returns>
@@ -247,9 +247,9 @@ public static bool IsQrCodeReference(XRReferenceImage image)
247247
}
248248

249249
/// <summary>
250-
/// Determine if the given refernce image is a marker reference.
250+
/// Determine if the given reference image is a marker reference.
251251
/// </summary>
252-
/// <param name="image">The refernce image with marker name or generated from
252+
/// <param name="image">The reference image with marker name or generated from
253253
/// <see cref="XRMarkerDatabase"/>.</param>
254254
/// <returns>
255255
/// <c>true</c>, if it's a valid marker reference.

Runtime/Features/XRBodyTrackingFeature.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public class XRBodyTrackingFeature : OpenXRFeature
7373
public const string ExtensionString = "XR_ANDROIDX_body_tracking";
7474

7575
/// <summary>
76-
/// Runtime permission requried to enable body tracking.
76+
/// Runtime permission required to enable body tracking.
7777
/// </summary>
7878
public static readonly AndroidXRPermission RequiredPermission =
7979
AndroidXRPermission.BodyTracking;

Runtime/Features/XRSceneMeshingFeature.cs

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ namespace Google.XR.Extensions
3131
#endif // UNITY_EDITOR
3232

3333
/// <summary>
34-
/// This feature provides access to the <c>XR_ANDROIDX_scene_meshing</c> extension.
34+
/// This feature provides access to the <c>XR_ANDROID_scene_meshing</c> extension.
3535
/// </summary>
3636
#if UNITY_EDITOR
3737
[OpenXRFeature(
@@ -50,7 +50,7 @@ public class XRSceneMeshingFeature : OpenXRFeature
5050
/// The UI name shows on the XR Plug-in Management panel, help users to understand
5151
/// validation errors and expected fixes.
5252
/// </summary>
53-
public const string UiName = "Android XR (Extensions): Scene Meshing (Experimental*)";
53+
public const string UiName = "Android XR (Extensions): Scene Meshing";
5454

5555
/// <summary>
5656
/// The feature ID string.
@@ -60,7 +60,7 @@ public class XRSceneMeshingFeature : OpenXRFeature
6060
/// <summary>
6161
/// The required OpenXR extension.
6262
/// </summary>
63-
public const string ExtensionString = "XR_ANDROIDX_scene_meshing";
63+
public const string ExtensionString = "XR_ANDROID_scene_meshing";
6464

6565
/// <summary>
6666
/// Runtime permission required to enable scene understanding fine.
@@ -73,7 +73,7 @@ public class XRSceneMeshingFeature : OpenXRFeature
7373
/// <summary>
7474
/// Gets if the required OpenXR extension is enabled.
7575
/// When OpenXR runtime is waiting, it returns <c>null</c>. Otherwise, it indicates
76-
/// whether the <c>XR_ANDROIDX_scene_meshing</c> extensions is
76+
/// whether the <c>XR_ANDROID_scene_meshing</c> extensions is
7777
/// available on current device.
7878
/// </summary>
7979
public static bool? IsExtensionEnabled => _extensionEnabled;
@@ -108,7 +108,7 @@ protected override void OnSubsystemCreate()
108108
/// <inheritdoc/>
109109
protected override void OnSubsystemStart()
110110
{
111-
XRSceneMeshingApi.Enable();
111+
XRSceneMeshingApi.SetEnabled(true);
112112
//// Currently, this feature is not compatible with ARMeshManager due to ARMeshManager
113113
//// creating and destroying meshes very fast. Expect to use XRMeshSubsystem directly
114114
//// and rely on OpenXRFeature's subsystem callbacks to manage XRMeshSubsystem's
@@ -119,7 +119,7 @@ protected override void OnSubsystemStart()
119119
/// <inheritdoc/>
120120
protected override void OnSubsystemStop()
121121
{
122-
XRSceneMeshingApi.Disable();
122+
XRSceneMeshingApi.SetEnabled(false);
123123
//// Currently, this feature is not compatible with ARMeshManager due to ARMeshManager
124124
//// creating and destroying meshes very fast. Expect to use XRMeshSubsystem directly
125125
//// and rely on OpenXRFeature's subsystem callbacks to manage XRMeshSubsystem's
@@ -132,20 +132,5 @@ protected override void OnSubsystemDestroy()
132132
{
133133
DestroySubsystem<XRMeshSubsystem>();
134134
}
135-
136-
#if UNITY_EDITOR
137-
/// <inheritdoc/>
138-
protected override void GetValidationChecks(
139-
List<ValidationRule> results, BuildTargetGroup targetGroup)
140-
{
141-
if (targetGroup != BuildTargetGroup.Android)
142-
{
143-
return;
144-
}
145-
146-
results.Add(AndroidXRFeatureUtils.GetExperimentalFeatureValidationCheck(
147-
this, UiName, targetGroup));
148-
}
149-
#endif // UNITY_EDITOR
150135
}
151136
}

Runtime/Features/XRSessionFeature.cs

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public class XRSessionFeature : OpenXRFeature
9595
private static bool _arSessionFeatureInUse = false;
9696

9797
[SerializeField]
98-
private bool _vulkanSubsampling = false;
98+
private bool _vulkanSubsampling = true;
9999

100100
[SerializeField]
101101
private bool _spacewarp = false;
@@ -312,5 +312,66 @@ protected override void OnSubsystemDestroy()
312312
_sessionSubsystem = null;
313313
}
314314
}
315+
316+
#if UNITY_EDITOR
317+
/// <inheritdoc/>
318+
protected override void GetValidationChecks(
319+
List<ValidationRule> results, BuildTargetGroup targetGroup)
320+
{
321+
if (targetGroup != BuildTargetGroup.Android)
322+
{
323+
return;
324+
}
325+
326+
results.Add(new ValidationRule(this)
327+
{
328+
message = "Foveation feature is required for <b>Subsampling (Vulkan)</b>.",
329+
checkPredicate = () =>
330+
{
331+
if (!VulkanSubsampling)
332+
{
333+
return true;
334+
}
335+
336+
var settings = OpenXRSettings.GetSettingsForBuildTargetGroup(targetGroup);
337+
if (settings == null)
338+
{
339+
return false;
340+
}
341+
342+
var foveation = GraphicsSettings.defaultRenderPipeline == null ?
343+
settings.GetFeature<XRFoveationFeature>() as OpenXRFeature:
344+
settings.GetFeature<FoveatedRenderingFeature>();
345+
return foveation != null && foveation.enabled;
346+
},
347+
fixItMessage = "Enable Foveation feature for <b>Subsampling (Vulkan)</b>.",
348+
fixIt = () =>
349+
{
350+
var settings = OpenXRSettings.GetSettingsForBuildTargetGroup(targetGroup);
351+
if (settings == null)
352+
{
353+
Debug.LogWarningFormat(
354+
"Autofix failed with missing OpenXRSettings on {0} platform.",
355+
targetGroup);
356+
return;
357+
}
358+
359+
var foveation = GraphicsSettings.defaultRenderPipeline == null ?
360+
settings.GetFeature<XRFoveationFeature>() as OpenXRFeature :
361+
settings.GetFeature<FoveatedRenderingFeature>();
362+
if (foveation == null)
363+
{
364+
Debug.LogWarningFormat(
365+
"Autofix failed with missing Foveation feature on {0} platform.",
366+
targetGroup);
367+
return;
368+
}
369+
370+
foveation.enabled = true;
371+
},
372+
error = true
373+
});
374+
}
375+
#endif // UNITY_EDITOR
315376
}
316377
}

Runtime/Google.XR.Extensions.asmdef

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@
1212
"GUID:e7613e527d035461da6942ba7283ee2d",
1313
"Unity.XR.CompositionLayers"
1414
],
15-
"includePlatforms": [],
15+
"includePlatforms": [
16+
"Android",
17+
"Editor",
18+
"macOSStandalone",
19+
"WindowsStandalone32",
20+
"WindowsStandalone64"
21+
],
1622
"excludePlatforms": [],
1723
"allowUnsafeCode": true,
1824
"overrideReferences": false,

Runtime/Internal/XRSceneMeshingApi.cs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,9 @@ namespace Google.XR.Extensions.Internal
2525

2626
internal class XRSceneMeshingApi
2727
{
28-
public static bool Enable()
28+
public static void SetEnabled(bool enabled)
2929
{
30-
return ExternalApi.XrSceneMeshing_enableSceneMeshing(XRInstanceManagerApi.GetIntPtr());
31-
}
32-
33-
public static bool Disable()
34-
{
35-
return ExternalApi.XrSceneMeshing_disableSceneMeshing(XRInstanceManagerApi.GetIntPtr());
30+
ExternalApi.XrSceneMeshing_setEnabled(XRInstanceManagerApi.GetIntPtr(), enabled);
3631
}
3732

3833
public static bool IsSceneMeshId(ref MeshId mesh_id)
@@ -47,19 +42,27 @@ public static IntPtr GetMeshSemantics(ref MeshId mesh_id, ref uint count)
4742
XRInstanceManagerApi.GetIntPtr(), ref mesh_id, ref count);
4843
}
4944

50-
private struct ExternalApi
45+
public static XRSceneMeshTrackingState GetSceneMeshTrackingState()
5146
{
52-
[DllImport(ApiConstants.OpenXRAndroidApi)]
53-
public static extern bool XrSceneMeshing_enableSceneMeshing(IntPtr manager);
47+
XRSceneMeshTrackingState state = XRSceneMeshTrackingState.ERROR;
48+
ExternalApi.XrSceneMeshing_getSceneMeshTrackingState(
49+
XRInstanceManagerApi.GetIntPtr(), ref state);
50+
return state;
51+
}
5452

53+
private struct ExternalApi
54+
{
5555
[DllImport(ApiConstants.OpenXRAndroidApi)]
56-
public static extern bool XrSceneMeshing_disableSceneMeshing(IntPtr manager);
56+
public static extern bool XrSceneMeshing_setEnabled(IntPtr manager, bool enabled);
5757
[DllImport(ApiConstants.OpenXRAndroidApi)]
5858
public static extern bool XrSceneMeshing_isSceneMeshId(
5959
IntPtr manager, ref MeshId mesh_id);
6060
[DllImport(ApiConstants.OpenXRAndroidApi)]
6161
public static extern IntPtr XrSceneMeshing_getMeshSemantics(
6262
IntPtr manager, ref MeshId mesh_id, ref uint count);
63+
[DllImport(ApiConstants.OpenXRAndroidApi)]
64+
public static extern void XrSceneMeshing_getSceneMeshTrackingState(
65+
IntPtr manager, ref XRSceneMeshTrackingState out_state);
6366
}
6467
}
6568
}

0 commit comments

Comments
 (0)