Skip to content

Commit

Permalink
com.unity.xr.magicleap@7.0.0-pre.2
Browse files Browse the repository at this point in the history
## [7.0.0-pre.2] - 2022-12-01

- Update subsystem registration for gesture components.
- Fixed bug where Use MLAudio checkbox in Project settings does not save between Unity sessions
  • Loading branch information
Unity Technologies committed Dec 1, 2022
1 parent 52ad32e commit b8f093a
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 62 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ uid: magic-leap-changelog

# Changelog

## [7.0.0-pre.1] - 2922-10-10
## [7.0.0-pre.2] - 2022-12-01

- Update subsystem registration for gesture components.
- Fixed bug where Use MLAudio checkbox in Project settings does not save between Unity sessions

## [7.0.0-pre.1] - 2022-10-10

- Added enforcement that the camera's near clipping plane will be at least the amount specified by MagicLeap Graphics API.

Expand Down
4 changes: 1 addition & 3 deletions Editor/MagicLeapSettingsEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ public override void OnInspectorGUI()
if (m_ShowAudioSettings)
{
EditorGUI.indentLevel++;
MagicLeapSettings.currentSettings.enableMLAudio = EditorGUILayout.Toggle( s_EnableMLAudioLabel, MagicLeapSettings.currentSettings.enableMLAudio);
var typeRect = GUILayoutUtility.GetLastRect();
GUI.Label(typeRect, new GUIContent("", "Enable MLAudio Support. Replaces default Android Audio Support."));
DrawPropertiesExcluding(serializedObject, new string[] { "m_Script", "m_DepthPrecision", "m_ForceMultipass", "m_HeadlockGraphics" });
EditorGUI.indentLevel--;
}

Expand Down
38 changes: 9 additions & 29 deletions Runtime/Gesture/MagicLeapGestureSubsystem.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
using System;
using System.Linq;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using System.Runtime.InteropServices;
using UnityEngine;
using UnityEngine.Scripting;
using UnityEngine.XR.InteractionSubsystems;

Expand All @@ -19,19 +16,7 @@ public sealed class MagicLeapGestureSubsystem : XRGestureSubsystem
/// A collection of all MagicLeapTouchpadGestureEvents managed by this subsystem.
/// This is cleared every frame and refreshed with new gesture events.
/// </summary>
public NativeArray<MagicLeapTouchpadGestureEvent> touchpadGestureEvents { get { return magicLeapProvider.touchpadGestureEvents; } }

MagicLeapGestureProvider magicLeapProvider;

/// <summary>
/// Creates the provider interface.
/// </summary>
/// <returns>The provider interface for MagicLeap</returns>
protected override Provider CreateProvider()
{
magicLeapProvider = new MagicLeapGestureProvider();
return magicLeapProvider;
}
public NativeArray<MagicLeapTouchpadGestureEvent> touchpadGestureEvents => ((provider as MagicLeapGestureProvider)!).touchpadGestureEvents;

internal bool ControllerGesturesEnabled
{
Expand All @@ -40,7 +25,7 @@ internal bool ControllerGesturesEnabled
#if UNITY_ANDROID
return NativeApi.IsControllerGesturesEnabled();
#else
Debug.LogWarning("Attempting to get MagicLeapGestureSubsystem.ControllerGesturesEnabled while not on a Magic Leap platform. This will be ignored.");
Debug.LogError($"Cannot get {nameof(MagicLeapGestureSubsystem.ControllerGesturesEnabled)} while not on the Magic Leap platform. This will be ignored.");
return false;
#endif // UNITY_ANDROID
}
Expand All @@ -49,12 +34,12 @@ internal bool ControllerGesturesEnabled
#if UNITY_ANDROID
NativeApi.SetControllerGesturesEnabled(value);
#else
Debug.LogWarning("Attempting to set MagicLeapGestureSubsystem.ControllerGesturesEnabled while not on a Magic Leap platform. This will be ignored.");
Debug.LogError($"Cannot set {nameof(MagicLeapGestureSubsystem.ControllerGesturesEnabled)} while not on the Magic Leap platform. This will be ignored.");
#endif // UNITY_ANDROID
}
}

class MagicLeapGestureProvider : Provider
internal class MagicLeapGestureProvider : Provider
{
public MagicLeapGestureProvider()
{
Expand All @@ -81,7 +66,6 @@ public override void Update()
{
#if UNITY_ANDROID
NativeApi.Update();

RetrieveGestureEvents();
#endif // UNITY_ANDROID
}
Expand All @@ -107,24 +91,19 @@ unsafe void GetGestureEvents<T>(ref NativeArray<T> gestureEventsArray, GetGestur

unsafe void RetrieveGestureEvents()
{
#if UNITY_ANDROID
if (NativeApi.IsControllerGesturesEnabled())
GetGestureEvents<MagicLeapTouchpadGestureEvent>(ref m_TouchpadGestureEvents, NativeApi.GetTouchpadGestureEventsPtr);

// Count up valid activate gestures (Have to do this as we cannot dynamically grow NativeArray).
// This should be possible to fix with NativeList (when out of preview package).
int activateGestureEventCount = 0;
if (m_ActivateGestureEvents.IsCreated)
m_ActivateGestureEvents.Dispose();
m_ActivateGestureEvents = new NativeArray<ActivateGestureEvent>(activateGestureEventCount, Allocator.Persistent);
#endif // UNITY_ANDROID
}

public override void Destroy()
{
#if UNITY_ANDROID
NativeApi.Destroy();
#endif // UNITY_ANDROID

m_TouchpadGestureEvents.Dispose();
#endif // UNITY_ANDROID
base.Destroy();
}

Expand All @@ -142,7 +121,8 @@ static void RegisterDescriptor()
new XRGestureSubsystemDescriptor.Cinfo
{
id = "MagicLeap-Gesture",
subsystemImplementationType = typeof(MagicLeapGestureSubsystem),
providerType = typeof(MagicLeapGestureSubsystem.MagicLeapGestureProvider),
subsystemTypeOverride = typeof(MagicLeapGestureSubsystem),
}
);
#endif // UNITY_ANDROID
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Gesture/MagicLeapGestures.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using UnityEngine.XR.Management;
using UnityEngine.XR.InteractionSubsystems;
using UnityEngine.XR.Management;

namespace UnityEngine.XR.MagicLeap
{
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Gesture/MagicLeapTouchpadGestureEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -278,4 +278,4 @@ public bool Equals(MagicLeapTouchpadGestureEvent other)
float m_Speed;
MagicLeapInputControllerTouchpadGestureType m_Type;
}
}
}
18 changes: 3 additions & 15 deletions Runtime/MagicLeapLoader.cs
Original file line number Diff line number Diff line change
@@ -1,28 +1,16 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;

using UnityEngine.XR;
using UnityEngine.XR.ARSubsystems;
using UnityEngine.XR.InteractionSubsystems;
using UnityEngine.XR.MagicLeap.Meshing;
using UnityEngine.XR.MagicLeap.Rendering;
using UnityEngine.XR.Management;

#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.XR.Management;
using UnityEngine.Rendering;
#endif //UNITY_EDITOR

#if UNITY_INPUT_SYSTEM
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Layouts;
using UnityEngine.InputSystem.XR;
#endif //UNITY_INPUT_SYSTEM

#if UNITY_2020_1_OR_NEWER
using XRTextureLayout = UnityEngine.XR.XRDisplaySubsystem.TextureLayout;
#endif // UNITY_2020_1_OR_NEWER
Expand Down Expand Up @@ -87,7 +75,7 @@ enum Privileges : uint

// Expose subsystem lifecycle events and methods internally so that
// the MagicLeap UnitySDK can drive subsystems that the XR Package doesn't have supported.
// Subscribe to any of the events you need and then use the below functions to
// Subscribe to any of the events you need and then use the below functions to
// trigger the lifecycle change of a subsystem.
/* Example (using the anchor subsystem):
MagicLeapLoader.OnSubsystemsCreate += OnSubsystemsCreate;
Expand All @@ -98,8 +86,8 @@ enum Privileges : uint
internal static event Action<MagicLeapLoader> OnSubsystemsStop;
internal static event Action<MagicLeapLoader> OnSubsystemsDestroy;

// These calls used in conjunction with the above events to create/start/stop/destroy the subsystems
// that are not supported by the XR Package alone. After subscribing to one of the above lifecycle events
// These calls used in conjunction with the above events to create/start/stop/destroy the subsystems
// that are not supported by the XR Package alone. After subscribing to one of the above lifecycle events
// these calls are used to actually trigger the lifecycle change.
internal void ForwardCreateSubsystem<TDescriptor, TSubsystem>(List<TDescriptor> descriptors, string id)
where TDescriptor : ISubsystemDescriptor
Expand Down
8 changes: 0 additions & 8 deletions Runtime/Plugins/Android.meta

This file was deleted.

Binary file modified Runtime/Windows/UnityMagicLeap.dll
Binary file not shown.
Binary file modified Runtime/macOS_arm64/UnityMagicLeap.bundle
Binary file not shown.
Binary file modified Runtime/macOS_x64/UnityMagicLeap.bundle
Binary file not shown.
12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "com.unity.xr.magicleap",
"displayName": "Magic Leap XR Plugin",
"version": "7.0.0-pre.1",
"version": "7.0.0-pre.2",
"unity": "2022.2",
"description": "Provides rendering and spatial mapping support for Magic Leap 2.",
"keywords": [
Expand All @@ -18,17 +18,21 @@
"com.unity.modules.xr": "1.0.0",
"com.unity.ugui": "1.0.0",
"com.unity.xr.arfoundation": "5.0.0-pre.12",
"com.unity.xr.interactionsubsystems": "1.0.1",
"com.unity.xr.interactionsubsystems": "2.0.0",
"com.unity.xr.management": "4.2.0",
"com.unity.modules.androidjni": "1.0.0"
},
"_upm": {
"changelog": "- Update subsystem registration for gesture components.\r\n- Fixed bug where Use MLAudio checkbox in Project settings does not save between Unity sessions"
},
"upmCi": {
"footprint": "803feadb6ffba7513b4014d65a6f712a0e6ec863"
"footprint": "4a76a2d23e0d57b74cb15f7a446e2d112f725616"
},
"documentationUrl": "https://docs.unity3d.com/Packages/com.unity.xr.magicleap@7.0/manual/index.html",
"repository": {
"url": "https://github.cds.internal.unity3d.com/unity/xr.sdk.magicleap.git",
"type": "git",
"revision": "12a4ed20d3863f4f54f2875fe69ee01f4189217b"
"revision": "19935d9678c735cb83e65b762ca6f6a038cbf69f"
},
"samples": [
{
Expand Down

0 comments on commit b8f093a

Please sign in to comment.