diff --git a/CHANGELOG.md b/CHANGELOG.md
index be22f29..c2a6532 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,23 @@
# Changelog
+## [4.2.0-preview.3] - 2020-08-19
+- Fix issue causing CI testing to fail erroneously.
+
+## [4.2.0-preview.2] - 2020-08-17
+- Update the target Unity version to 2019.4f4.4
+
+## [4.2.0-preview.1] - 2020-04-14
+- Update XR Management Dependency to 3.2.10
+- Added manifest setting to enable background music privileges
+- APIs added for `QuerySupportedTrackingOriginModes`, `QueryTrackingOriginMode`, and `SetTrackingOriginMode`
+- Fixed issue where controller state information was incorrectly surfaced from the companion application
+- Fixed issue where Zero Iteration libraries where incorrectly imported for MacOS
+- Fixed issue where using `NativeArrayUnsafeUtility.ConvertExistingDataToNativeArray` resulted in an error while running in the Editor
+- Fix issue where UnityMagicLeap libraries were included in Standalone Desktop builds when using Magic Leap
+Zero Iteration Plugin Provider from XR Management (The intent of the Standalone Desktop provider is to allow
+rapid iteration from the Unity Editor with Magic Leap's The Lab Zero Iteration module and not for use in standalone
+builds)
+
## [4.1.3] - 2020-04-07
- Conditionally compile out XR Management related classes that depend on XR Management `3.2.x`
- Revert dependency on XR Management `3.0.6`
diff --git a/Editor/MagicLeapBuildProcessor.cs b/Editor/MagicLeapBuildProcessor.cs
index ddc8632..e6d9cbd 100644
--- a/Editor/MagicLeapBuildProcessor.cs
+++ b/Editor/MagicLeapBuildProcessor.cs
@@ -1,7 +1,12 @@
using System.Linq;
+using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
+using UnityEditor.XR.Management;
+
+using UnityEngine;
+using UnityEngine.XR.Management;
using UnityEngine.XR.MagicLeap;
@@ -11,6 +16,9 @@ public class MagicLeapBuildProcessor : IPreprocessBuildWithReport, IPostprocessB
{
public int callbackOrder => 0;
+ private string[] runtimePluginNames = new string[] { "UnityMagicLeap.elf", "UnityMagicLeap.so" };
+ private string[] remotingPluginNames = new string[] { "UnityMagicLeap.dll", "UnityMagicLeap.dylib" };
+
void CleanOldSettings()
{
UnityEngine.Object[] preloadedAssets = PlayerSettings.GetPreloadedAssets();
@@ -18,7 +26,7 @@ void CleanOldSettings()
return;
var oldSettings = from s in preloadedAssets
- where s.GetType() == typeof(MagicLeapSettings)
+ where (s != null) && (s.GetType() == typeof(MagicLeapSettings))
select s;
if (oldSettings.Any())
@@ -33,8 +41,65 @@ where s.GetType() == typeof(MagicLeapSettings)
}
}
+ public bool ShouldIncludeRuntimePluginsInBuild(string path)
+ {
+ // Return false if not on platform Lumin
+#if PLATFORM_LUMIN
+ XRGeneralSettings generalSettings = XRGeneralSettingsPerBuildTarget.XRGeneralSettingsForBuildTarget(BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget));
+ if (generalSettings == null)
+ return false;
+
+ foreach (var loader in generalSettings.Manager.loaders)
+ {
+ if (loader is MagicLeapLoader)
+ return true;
+ }
+#endif // PLATFORM_LUMIN
+
+ return false;
+ }
+
+ // Remoting is only intended to work in the editor so builds are disallowed to have the libraries
+ public bool ShouldIncludeRemotingPluginsInBuild(string path) => false;
+
+ void AssignNativePluginIncludeInBuildDelegates()
+ {
+ // For each plugin within the project, check if it is a plugin generated by this
+ // package and assign the Include in build delegate to prevent magic leap libraries
+ // from being included on other platforms
+ var allPlugins = PluginImporter.GetAllImporters();
+ foreach (var plugin in allPlugins)
+ {
+ if (plugin.isNativePlugin)
+ {
+ foreach (var pluginName in runtimePluginNames)
+ {
+ if (plugin.assetPath.Contains(pluginName))
+ {
+ plugin.SetIncludeInBuildDelegate(ShouldIncludeRuntimePluginsInBuild);
+ break;
+ }
+ }
+
+ foreach (var pluginName in remotingPluginNames)
+ {
+ if (plugin.assetPath.Contains(pluginName))
+ {
+ plugin.SetIncludeInBuildDelegate(ShouldIncludeRemotingPluginsInBuild);
+ break;
+ }
+ }
+ }
+ }
+ }
+
public void OnPreprocessBuild(BuildReport report)
{
+ // Assign each library a "ShouldIncludeInBuild" delegate to indicate whether the plugin
+ // should be placed in a build on a specific platform. As of right now it's only important
+ // for runtime on the device but that could change to have standalone include remoting libs
+ AssignNativePluginIncludeInBuildDelegates();
+
// Always remember to cleanup preloaded assets after build to make sure we don't
// dirty later builds with assets that may not be needed or are out of date.
CleanOldSettings();
diff --git a/Editor/Manifest/MagicLeapManifestBuildProcessor.cs b/Editor/Manifest/MagicLeapManifestBuildProcessor.cs
index 4ff83a5..72d0de7 100644
--- a/Editor/Manifest/MagicLeapManifestBuildProcessor.cs
+++ b/Editor/Manifest/MagicLeapManifestBuildProcessor.cs
@@ -32,14 +32,16 @@ class MagicLeapManifestBuildProcessor : IPreprocessBuildWithReport
public void OnPreprocessBuild(BuildReport report)
{
- //Debug.LogFormat("PreprocessBuild : Manifest");
- var path = MagicLeapManifestSettings.kBuildManifestPath;
- if (MagicLeapManifestSettings.customManifestExists)
+ if (report.summary.platform == BuildTarget.Lumin)
{
- Debug.LogWarningFormat(kManifestExistsWarning, MagicLeapManifestSettings.kCustomManifestPath);
- return;
+ var path = MagicLeapManifestSettings.kBuildManifestPath;
+ if (MagicLeapManifestSettings.customManifestExists)
+ {
+ Debug.LogWarningFormat(kManifestExistsWarning, MagicLeapManifestSettings.kCustomManifestPath);
+ return;
+ }
+ MergeToCustomManifest(MagicLeap.MagicLeapManifestSettings.GetOrCreateSettings(), path);
}
- MergeToCustomManifest(MagicLeap.MagicLeapManifestSettings.GetOrCreateSettings(), path);
}
private XDocument GetManifestTemplate()
@@ -109,6 +111,27 @@ private void MergeToCustomManifest(MagicLeapManifestSettings ctx, string path)
iconElement.SetAttributeValue(kML + "model_folder", "Icon/Model");
iconElement.SetAttributeValue(kML + "portal_folder", "Icon/Portal");
}
+
+ // Remove or Add "" element to match ctx.allowBackgroundMusicService setting
+ XElement playMusicAttribute = componentElement.Elements("music-attribute")
+ .Where(n => (string)n.Attribute(kML + "name") == "play").FirstOrDefault();
+
+ if (ctx.allowBackgroundMusicService)
+ {
+ // Add the element if it was not found and allowBackgroundMusicService is true.
+ if (playMusicAttribute == null)
+ {
+ componentElement.Add(new XElement("music-attribute", CreateAttribute("name", "play")));
+ }
+ }
+ else
+ {
+ // Remove element if it was found and allowBackgroundMusicService is false.
+ if (playMusicAttribute != null)
+ {
+ playMusicAttribute.Remove();
+ }
+ }
}
SetPrivileges(applicationElement, ctx.requiredPermissions.ToArray());
diff --git a/Editor/Manifest/MagicLeapManifestSettings.cs b/Editor/Manifest/MagicLeapManifestSettings.cs
index 21de645..703747a 100644
--- a/Editor/Manifest/MagicLeapManifestSettings.cs
+++ b/Editor/Manifest/MagicLeapManifestSettings.cs
@@ -18,6 +18,9 @@ public class MagicLeapManifestSettings : ScriptableObject
[SerializeField]
private int m_MinimumAPILevel;
+ [SerializeField]
+ private bool m_AllowBackgroundMusicService;
+
[SerializeField]
private PrivilegeGroup[] m_PrivilegeGroups;
@@ -34,6 +37,19 @@ public int minimumAPILevel
}
}
+ public bool allowBackgroundMusicService
+ {
+ get
+ {
+ return m_AllowBackgroundMusicService;
+ }
+ set
+ {
+ Undo.RecordObject(this, "Changed Allow Background Music Service");
+ m_AllowBackgroundMusicService = value;
+ }
+ }
+
public IEnumerable requiredPermissions
{
get
@@ -63,6 +79,7 @@ public static bool customManifestExists
get { return File.Exists(kCustomManifestPath); }
}
+
public static MagicLeapManifestSettings GetOrCreateSettings(string path = kDefaultSettingsPath)
{
if (string.IsNullOrEmpty(path))
@@ -75,8 +92,11 @@ public static MagicLeapManifestSettings GetOrCreateSettings(string path = kDefau
{
settings = ScriptableObject.CreateInstance();
settings.m_MinimumAPILevel = 4;
+ settings.m_AllowBackgroundMusicService = false;
if (SDKUtility.sdkAvailable)
+ {
settings.RebuildPrivilegeGroups(PrivilegeParser.ParsePrivilegesFromHeader(Path.Combine(SDKUtility.sdkPath, PrivilegeParser.kPrivilegeHeaderPath)));
+ }
else
Debug.LogWarning(ManifestEditorGUI.Messages.kCannotLocateSDK);
diff --git a/Editor/Manifest/ManifestEditorGUI.cs b/Editor/Manifest/ManifestEditorGUI.cs
index 24671db..361d43e 100644
--- a/Editor/Manifest/ManifestEditorGUI.cs
+++ b/Editor/Manifest/ManifestEditorGUI.cs
@@ -33,6 +33,10 @@ public static void RenderManifest(MagicLeapManifestSettings settings)
{
var apiLevel = serializedObject.FindProperty("m_MinimumAPILevel");
apiLevel.intValue = PlatformLevelSelector.SelectorGUI(apiLevel.intValue);
+
+ var allowBMS = serializedObject.FindProperty("m_AllowBackgroundMusicService");
+ allowBMS.boolValue = EditorGUILayout.ToggleLeft("Allow Background Music Service", allowBMS.boolValue);
+
EditorGUILayout.LabelField("Privileges", EditorStyles.boldLabel);
var priv_groups = serializedObject.FindProperty("m_PrivilegeGroups");
for (int i = 0; i < priv_groups.arraySize; i++)
@@ -60,6 +64,7 @@ public static void RenderManifest(MagicLeapManifestSettings settings)
}
EditorGUILayout.EndFoldoutHeaderGroup();
}
+
serializedObject.ApplyModifiedProperties();
GUILayout.FlexibleSpace();
EditorGUILayout.HelpBox(Messages.kShouldSynchronize, MessageType.Info, true);
diff --git a/Editor/Remote/MacOSDependencyTools.cs b/Editor/Remote/MacOSDependencyTools.cs
new file mode 100644
index 0000000..57324a3
--- /dev/null
+++ b/Editor/Remote/MacOSDependencyTools.cs
@@ -0,0 +1,124 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Text.RegularExpressions;
+
+using UnityDebug = UnityEngine.Debug;
+
+namespace UnityEditor.XR.MagicLeap
+{
+#if UNITY_EDITOR_OSX
+ class MacOSDependencyChecker
+ {
+ const string kRegexPattern = @"\t(.+) \(compatibility version \d{1,4}\.\d{1,4}\.\d{1,4}, current version \d{1,4}\.\d{1,4}\.\d{1,4}\)";
+
+ public class DependencyMap
+ {
+ public string file = null;
+ public List dependencies = new List();
+ }
+
+ internal static IEnumerable LaunchOtool(string filepath)
+ {
+ var psi = new ProcessStartInfo {
+ FileName = "/usr/bin/otool",
+ Arguments = string.Format("-L {0}", filepath),
+ WindowStyle = ProcessWindowStyle.Hidden,
+ CreateNoWindow = true,
+ RedirectStandardError = true,
+ RedirectStandardOutput = true,
+ UseShellExecute = false
+ };
+ using (Process p = Process.Start(psi))
+ {
+ var output = p.StandardOutput.ReadToEnd();
+ var error = p.StandardError.ReadToEnd();
+ p.WaitForExit();
+ return output.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
+ }
+ }
+
+ internal static DependencyMap GetDependencies(string file)
+ {
+ var regex = new Regex(kRegexPattern);
+ var dm = new DependencyMap { file = file };
+ var output = LaunchOtool(file);
+ foreach (var line in output)
+ {
+ var m = regex.Match(line);
+ if (m.Success)
+ {
+ var dep_path = m.Groups[1].Value;
+ foreach (var prefix in new string[] { "@loader_path", "@rpath"} )
+ dep_path = dep_path.Replace(prefix, Path.GetDirectoryName(file));
+ dm.dependencies.Add(dep_path);
+ }
+ }
+ return dm;
+ }
+
+ internal static void Migrate(string src, string dest)
+ {
+ var dir = Path.GetDirectoryName(dest);
+ using (new WorkingDirectoryShift(dir))
+ {
+ var psi = new ProcessStartInfo {
+ FileName = "lipo",
+ Arguments = string.Format("-create {0} -output {1}", src, Path.GetFileName(dest)),
+ WindowStyle = ProcessWindowStyle.Hidden,
+ CreateNoWindow = true
+ };
+ using (Process p = Process.Start(psi))
+ p.WaitForExit();
+
+ psi = new ProcessStartInfo {
+ FileName = "install_name_tool",
+ Arguments = string.Format("-id {0} {0}", Path.GetFileName(dest)),
+ WindowStyle = ProcessWindowStyle.Hidden,
+ CreateNoWindow = true
+ };
+ using (Process p = Process.Start(psi))
+ p.WaitForExit();
+
+ }
+
+ }
+
+ internal static void MigrateWithDependencies(string src, string dest)
+ {
+ var original_deps = GetDependencies(src);
+ Migrate(src, dest);
+ var new_deps = GetDependencies(dest);
+ var missing = new List();
+ using (new WorkingDirectoryShift(Path.GetDirectoryName(dest)))
+ {
+ foreach (var dep in new_deps.dependencies)
+ {
+ if (File.Exists(dep))
+ continue;
+ else
+ missing.Add(dep);
+ }
+ }
+ foreach (var item in missing)
+ {
+ var dep_path = Path.GetFullPath(item);
+ if (!File.Exists(dep_path))
+ {
+ var dep_file = Path.GetFileName(item);
+ foreach (var old_dep in original_deps.dependencies)
+ {
+ if (Path.GetFileName(old_dep) == dep_file)
+ {
+ Directory.CreateDirectory(Path.GetDirectoryName(dep_path));
+ if (File.Exists(old_dep))
+ File.Copy(old_dep, dep_path);
+ }
+ }
+ }
+ }
+ }
+ }
+#endif
+}
diff --git a/Editor/Remote/MacOSDependencyTools.cs.meta b/Editor/Remote/MacOSDependencyTools.cs.meta
new file mode 100644
index 0000000..c224e25
--- /dev/null
+++ b/Editor/Remote/MacOSDependencyTools.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 97e2da44065d6406984aeea4e09bb35e
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Editor/Remote/MagicLeapRemoteImportSupport.cs b/Editor/Remote/MagicLeapRemoteImportSupport.cs
index 798f37d..d14cc9c 100644
--- a/Editor/Remote/MagicLeapRemoteImportSupport.cs
+++ b/Editor/Remote/MagicLeapRemoteImportSupport.cs
@@ -59,85 +59,6 @@ public ImportFailureException(string path) : base(string.Format(kHelpMessage, pa
}
}
-#if UNITY_EDITOR_OSX
- class MacOSDependencyChecker
- {
- const string kRegexPattern = @"\t(.+) \(compatibility version \d{1,4}\.\d{1,4}\.\d{1,4}, current version \d{1,4}\.\d{1,4}\.\d{1,4}\)";
-
- public class DependencyMap
- {
- public string file = null;
- public List dependencies = new List();
- }
-
- internal static IEnumerable LaunchOtool(string filepath)
- {
- var psi = new ProcessStartInfo {
- FileName = "/usr/bin/otool",
- Arguments = string.Format("-L {0}", filepath),
- WindowStyle = ProcessWindowStyle.Hidden,
- CreateNoWindow = true,
- RedirectStandardError = true,
- RedirectStandardOutput = true,
- UseShellExecute = false
- };
- using (Process p = Process.Start(psi))
- {
- var output = p.StandardOutput.ReadToEnd();
- var error = p.StandardError.ReadToEnd();
- p.WaitForExit();
- return output.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
- }
- }
-
- internal static DependencyMap GetDependencies(string file)
- {
- var regex = new Regex(kRegexPattern);
- var dm = new DependencyMap { file = file };
- var output = LaunchOtool(file);
- foreach (var line in output)
- {
- var m = regex.Match(line);
- if (m.Success)
- {
- var dep_path = m.Groups[1].Value;
- dm.dependencies.Add(dep_path.Replace("@loader_path", Path.GetDirectoryName(file)));
- }
- }
- return dm;
- }
-
- internal static void Migrate(string src, string dest)
- {
- var dir = Path.GetDirectoryName(dest);
- using (new WorkingDirectoryShift(dir))
- {
- var psi = new ProcessStartInfo {
- FileName = "lipo",
- Arguments = string.Format("-create {0} -output {1}", src, Path.GetFileName(dest)),
- WindowStyle = ProcessWindowStyle.Hidden,
- CreateNoWindow = true
- };
- //UnityDebug.LogFormat("{0} {1}", psi.FileName, psi.Arguments);
- using (Process p = Process.Start(psi))
- p.WaitForExit();
-
- psi = new ProcessStartInfo {
- FileName = "install_name_tool",
- Arguments = string.Format("-id {0} {0}", Path.GetFileName(dest)),
- WindowStyle = ProcessWindowStyle.Hidden,
- CreateNoWindow = true
- };
- //UnityDebug.LogFormat("{0} {1}", psi.FileName, psi.Arguments);
- using (Process p = Process.Start(psi))
- p.WaitForExit();
-
- }
-
- }
- }
-#endif
-
public static class MagicLeapRemoteImportSupport
{
const string kDestinationProjectFolder = "Assets/Plugins/Lumin/Editor/x64";
@@ -384,6 +305,18 @@ internal static string GetOSXTargetPath(string destFolder, string srcPath)
}
return null;
}
+
+ internal static bool TryFindDependencyOnSearchPath(string file_name, out string dep_path)
+ {
+ foreach (var path in shimSearchPaths)
+ {
+ dep_path = Path.Combine(path, file_name);
+ if (File.Exists(dep_path) || Directory.Exists(dep_path)) // need to check directories too, because osx has bundle-type things...
+ return true;
+ }
+ dep_path = null;
+ return false;
+ }
#endif
internal static void ImportSupportLibrares(string destFolder)
@@ -391,38 +324,41 @@ internal static void ImportSupportLibrares(string destFolder)
Directory.CreateDirectory(destFolder);
foreach (var lib in LocateMLRemoteLibraries())
{
- //UnityDebug.Log(lib);
#if UNITY_EDITOR_OSX
+
var target = GetOSXTargetPath(destFolder, lib);
if (target == null) continue;
CheckIfFileCanBeCopiedAndThrow(lib, target);
- MacOSDependencyChecker.Migrate(lib, target);
- var dm = MacOSDependencyChecker.GetDependencies(target);
- var missing = new List();
- using (new WorkingDirectoryShift(Path.GetDirectoryName(target)))
- {
- foreach (var dep in dm.dependencies)
+ if (SDKUtility.sdkVersion <= new Version("0.23.0"))
+ MacOSDependencyChecker.MigrateWithDependencies(lib, target);
+ else
+ MacOSDependencyChecker.Migrate(lib, target);
+ var dm = MacOSDependencyChecker.GetDependencies(target);
+ var missing = new List();
+ using (new WorkingDirectoryShift(Path.GetDirectoryName(target)))
{
- if (File.Exists(dep))
- continue;
- else
- missing.Add(dep);
+ foreach (var dep in dm.dependencies)
+ {
+ if (File.Exists(dep))
+ continue;
+ else
+ missing.Add(dep);
+ }
}
- }
- foreach (var item in missing)
- {
- var dep_path = Path.GetFullPath(item);
- if (!File.Exists(dep_path))
+ foreach (var item in missing)
{
- //UnityDebug.LogFormat("missing dep: {0} for {1}", dep_path, dm.file);
- Directory.CreateDirectory(Path.GetDirectoryName(dep_path));
- var src = Path.Combine(macOSDependencyPath, Path.GetFileName(item));
- //UnityDebug.LogFormat("searching for {0}: {1}", Path.GetFileName(item), src);
- if (File.Exists(src))
- File.Copy(src, dep_path);
+ var dep_path = Path.GetFullPath(item);
+ if (!File.Exists(dep_path))
+ {
+ var dep_file = Path.GetFileName(item);
+ if (TryFindDependencyOnSearchPath(dep_file, out var src))
+ {
+ Directory.CreateDirectory(Path.GetDirectoryName(dep_path));
+ if (File.Exists(src))
+ File.Copy(src, dep_path);
+ }
+ }
}
-
- }
#else
var basename = Path.GetFileName(lib);
var target = Path.Combine(destFolder, basename);
@@ -455,4 +391,4 @@ static bool CanImport()
return true;
}
}
-}
\ No newline at end of file
+}
diff --git a/Editor/SDKUtility.cs b/Editor/SDKUtility.cs
index 97187f9..79b376d 100644
--- a/Editor/SDKUtility.cs
+++ b/Editor/SDKUtility.cs
@@ -3,6 +3,7 @@
using System.Runtime.InteropServices;
using UnityEditor;
+using UnityEngine;
namespace UnityEditor.XR.MagicLeap
{
@@ -25,6 +26,11 @@ static class Native
public static extern uint GetAPILevel();
}
+ public class SDKManifest
+ {
+ public string version;
+ }
+
internal static bool isCompatibleSDK
{
get
@@ -77,5 +83,9 @@ internal static string sdkPath
return EditorPrefs.GetString("LuminSDKRoot", null);
}
}
+ internal static Version sdkVersion
+ {
+ get => new Version(JsonUtility.FromJson(File.ReadAllText(Path.Combine(sdkPath, kManifestPath))).version);
+ }
}
}
\ No newline at end of file
diff --git a/Editor/UnityEditor.XR.MagicLeap.asmdef b/Editor/UnityEditor.XR.MagicLeap.asmdef
index ebc824d..841ef75 100644
--- a/Editor/UnityEditor.XR.MagicLeap.asmdef
+++ b/Editor/UnityEditor.XR.MagicLeap.asmdef
@@ -2,6 +2,7 @@
"name": "UnityEditor.XR.MagicLeap",
"references": [
"UnityEngine.XR.MagicLeap",
+ "Unity.XR.Management",
"Unity.XR.Management.Editor"
],
"optionalUnityReferences": [],
@@ -21,4 +22,4 @@
"define": "XR_MANAGEMENT_3_2_0_OR_NEWER"
}
]
-}
\ No newline at end of file
+}
diff --git a/Runtime/Lumin/UnityMagicLeap.so b/Runtime/Lumin/UnityMagicLeap.so
index 17de305..4a72bd4 100644
Binary files a/Runtime/Lumin/UnityMagicLeap.so and b/Runtime/Lumin/UnityMagicLeap.so differ
diff --git a/Runtime/Plane/MagicLeapPlaneSubsystem.cs b/Runtime/Plane/MagicLeapPlaneSubsystem.cs
index ad909f6..1a58489 100644
--- a/Runtime/Plane/MagicLeapPlaneSubsystem.cs
+++ b/Runtime/Plane/MagicLeapPlaneSubsystem.cs
@@ -148,6 +148,11 @@ public unsafe PlaneBoundaryCollection GetAllBoundariesForPlane(TrackableId track
(int)m_BoundariesList.plane_boundaries_count,
Allocator.None);
+#if ENABLE_UNITY_COLLECTIONS_CHECK
+ var safetyHandle = AtomicSafetyHandle.Create();
+ NativeArrayUnsafeUtility.SetAtomicSafetyHandle(ref planeBoundaries, safetyHandle);
+#endif
+
// Find the plane boundaries with the given trackable id
foreach (var planeBoundaries in planeBoundariesArray)
{
diff --git a/Runtime/Plane/PlaneBoundary.cs b/Runtime/Plane/PlaneBoundary.cs
index d4811dd..2611b1d 100644
--- a/Runtime/Plane/PlaneBoundary.cs
+++ b/Runtime/Plane/PlaneBoundary.cs
@@ -135,6 +135,10 @@ public unsafe void GetHole(int index, Allocator allocator, ref NativeArray 0)
+ RenderingSettings.stabilizationDistance = distances.Max();
+ distances.Value.Dispose();
+ distances = null;
+ }
break;
}
}
@@ -178,10 +182,11 @@ public void ValidateFarClip()
if (!m_Camera) return;
var farClip = m_Camera.farClipPlane;
var max = RenderingSettings.maxFarClipDistance;
- if (enforceFarClip && farClip > max)
+ if (farClip > max)
{
MLWarnings.WarnedAboutFarClippingPlane.Trigger(farClip, max);
- m_Camera.farClipPlane = max;
+ if (enforceFarClip)
+ m_Camera.farClipPlane = max;
}
}
@@ -190,10 +195,11 @@ public void ValidateNearClip()
if (!m_Camera) return;
var nearClip = m_Camera.nearClipPlane;
var min = RenderingSettings.minNearClipDistance;
- if (enforceNearClip && nearClip < min)
+ if (nearClip < min)
{
MLWarnings.WarnedAboutNearClippingPlane.Trigger(nearClip, min);
- m_Camera.nearClipPlane = min;
+ if (enforceNearClip)
+ m_Camera.nearClipPlane = min;
}
}
diff --git a/Runtime/Rendering/RenderingSettings.cs b/Runtime/Rendering/RenderingSettings.cs
index ab64d93..0bac4a3 100644
--- a/Runtime/Rendering/RenderingSettings.cs
+++ b/Runtime/Rendering/RenderingSettings.cs
@@ -68,9 +68,9 @@ public static float farClipDistance
{
float farClip = kDefaultFarClip;
UnityMagicLeap_RenderingTryGetParameter("FarClipDistance", out farClip);
- return RenderingUtility.ToUnityUnits(farClip, s_CachedCameraScale);
+ return farClip;
}
- internal set { UnityMagicLeap_RenderingSetParameter("FarClipDistance", RenderingUtility.ToMagicLeapUnits(value, s_CachedCameraScale)); }
+ internal set { UnityMagicLeap_RenderingSetParameter("FarClipDistance", value); }
}
public static float focusDistance
{
@@ -78,9 +78,9 @@ public static float focusDistance
{
float focus = 0f;
UnityMagicLeap_RenderingTryGetParameter("FocusDistance", out focus);
- return RenderingUtility.ToUnityUnits(focus, s_CachedCameraScale);
+ return focus;
}
- internal set { UnityMagicLeap_RenderingSetParameter("FocusDistance", RenderingUtility.ToMagicLeapUnits(value, s_CachedCameraScale)); }
+ internal set { UnityMagicLeap_RenderingSetParameter("FocusDistance", value); }
}
public static FrameTimingHint frameTimingHint
{
@@ -107,7 +107,7 @@ public static float minNearClipDistance
{
float minNearClip = 0.5f;
UnityMagicLeap_RenderingTryGetParameter("MinNearClipDistance", out minNearClip);
- return RenderingUtility.ToUnityUnits(minNearClip, s_CachedCameraScale);
+ return minNearClip;
}
}
public static float nearClipDistance
@@ -116,9 +116,9 @@ public static float nearClipDistance
{
float nearClip = 0.5f;
UnityMagicLeap_RenderingTryGetParameter("NearClipDistance", out nearClip);
- return RenderingUtility.ToUnityUnits(nearClip, s_CachedCameraScale);
+ return nearClip;
}
- internal set { UnityMagicLeap_RenderingSetParameter("NearClipDistance", RenderingUtility.ToMagicLeapUnits(value, s_CachedCameraScale)); }
+ internal set { UnityMagicLeap_RenderingSetParameter("NearClipDistance", value); }
}
[Obsolete("use MagicLeapSettings.forceMultipass to force multipass rendering instead")]
public static bool singlePassEnabled
@@ -137,9 +137,9 @@ public static float stabilizationDistance
{
float distance = 10f;
UnityMagicLeap_RenderingTryGetParameter("StabilizationDistance", out distance);
- return RenderingUtility.ToUnityUnits(distance, s_CachedCameraScale);
+ return distance;
}
- internal set { UnityMagicLeap_RenderingSetParameter("StabilizationDistance", RenderingUtility.ToMagicLeapUnits(value, s_CachedCameraScale)); }
+ internal set { UnityMagicLeap_RenderingSetParameter("StabilizationDistance", value); }
}
public static bool useProtectedSurface
{
diff --git a/Runtime/Windows/UnityMagicLeap.dll b/Runtime/Windows/UnityMagicLeap.dll
index 87e3ac0..af799b5 100644
Binary files a/Runtime/Windows/UnityMagicLeap.dll and b/Runtime/Windows/UnityMagicLeap.dll differ
diff --git a/Runtime/Windows/UnityMagicLeap.dll.lib b/Runtime/Windows/UnityMagicLeap.dll.lib
index a97102c..5eed516 100644
Binary files a/Runtime/Windows/UnityMagicLeap.dll.lib and b/Runtime/Windows/UnityMagicLeap.dll.lib differ
diff --git a/Runtime/macOS/UnityMagicLeap.bundle b/Runtime/macOS/UnityMagicLeap.bundle
index 2f7105f..463bd9e 100644
Binary files a/Runtime/macOS/UnityMagicLeap.bundle and b/Runtime/macOS/UnityMagicLeap.bundle differ
diff --git a/Samples~/InputProviders/Unity.MagicLeap.Samples.InputProviders.asmdef b/Samples~/InputProviders/Unity.MagicLeap.Samples.InputProviders.asmdef
index b63ed6a..91823e1 100644
--- a/Samples~/InputProviders/Unity.MagicLeap.Samples.InputProviders.asmdef
+++ b/Samples~/InputProviders/Unity.MagicLeap.Samples.InputProviders.asmdef
@@ -4,7 +4,10 @@
"UnityEngine.SpatialTracking",
"UnityEngine.XR.MagicLeap"
],
- "includePlatforms": [],
+ "includePlatforms": [
+ "Editor",
+ "Lumin"
+ ],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
diff --git a/Samples~/InputProviders/XRInputEyeTrackingProvider.cs b/Samples~/InputProviders/XRInputEyeTrackingProvider.cs
index 7aa1dbb..9fd120b 100644
--- a/Samples~/InputProviders/XRInputEyeTrackingProvider.cs
+++ b/Samples~/InputProviders/XRInputEyeTrackingProvider.cs
@@ -1,7 +1,5 @@
using System.Collections.Generic;
#if USE_LEGACY_INPUT_HELPERS
-
-using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.Experimental.XR.Interaction;
diff --git a/Samples~/Rendering/Runtime/Unity.MagicLeap.Samples.Rendering.asmdef b/Samples~/Rendering/Runtime/Unity.MagicLeap.Samples.Rendering.asmdef
index 613d179..6c48df4 100644
--- a/Samples~/Rendering/Runtime/Unity.MagicLeap.Samples.Rendering.asmdef
+++ b/Samples~/Rendering/Runtime/Unity.MagicLeap.Samples.Rendering.asmdef
@@ -1,12 +1,16 @@
{
"name": "Unity.MagicLeap.Samples.Rendering",
"references": [],
- "includePlatforms": [],
+ "includePlatforms": [
+ "Editor",
+ "Lumin"
+ ],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
- "versionDefines": []
+ "versionDefines": [],
+ "noEngineReferences": false
}
\ No newline at end of file
diff --git a/Samples~/Rendering/Tests/Unity.MagicLeap.Samples.Rendering.Tests.asmdef b/Samples~/Rendering/Tests/Unity.MagicLeap.Samples.Rendering.Tests.asmdef
index 983de03..d79a0b6 100644
--- a/Samples~/Rendering/Tests/Unity.MagicLeap.Samples.Rendering.Tests.asmdef
+++ b/Samples~/Rendering/Tests/Unity.MagicLeap.Samples.Rendering.Tests.asmdef
@@ -7,10 +7,11 @@
"GUID:0acc523941302664db1f4e527237feb3",
"GUID:4e3c30dd36847b044bbb0be47153a753"
],
- "includePlatforms": [],
- "excludePlatforms": [
- "LinuxStandalone64"
+ "includePlatforms": [
+ "Editor",
+ "Lumin"
],
+ "excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": true,
"precompiledReferences": [
diff --git a/package.json b/package.json
index b2a8cf1..e2dcc7f 100644
--- a/package.json
+++ b/package.json
@@ -1,9 +1,9 @@
{
"name": "com.unity.xr.magicleap",
"displayName": "Magic Leap XR Plugin",
- "version": "4.1.3",
- "unity": "2019.3",
- "unityRelease": "0b9",
+ "version": "4.2.0-preview.3",
+ "unity": "2019.4",
+ "unityRelease": "4f1",
"description": "Provides rendering and spatial mapping support for Magic Leap.\n\nNOTE: As of Unity 2019.2, Legacy XR support for MagicLeap is disabled in favor of XR SDK",
"keywords": [
"magicleap",
@@ -20,13 +20,15 @@
"com.unity.ugui": "1.0.0",
"com.unity.xr.arsubsystems": "2.1.2",
"com.unity.xr.interactionsubsystems": "1.0.1",
- "com.unity.xr.management": "3.0.6"
+ "com.unity.xr.management": "3.2.10"
+ },
+ "upmCi": {
+ "footprint": "e3b980d34d4e803b5e0075f504fa86da16092f1a"
},
"repository": {
- "footprint": "ee5531410b96391b3613cb6b0813034cde28ad5e",
- "type": "git",
"url": "https://github.cds.internal.unity3d.com/unity/xr.sdk.magicleap.git",
- "revision": "be4db762c90bb8e515ff8e4ae4ca9d86257968c5"
+ "type": "git",
+ "revision": "730b9d5ad169b27a149ee14b450cc78a115afee5"
},
"samples": [
{