Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
## [4.1.0] - 2021-08-04
### Changes
* Messaging and removing the Lumin platform in 2021.1+. Support is still maintained for Unity 2020 LTS and 2019 LTS.
### Fixes
* Fix [1343655](https://issuetracker.unity3d.com/product/unity/issues/guid/1343655/) by adding an API for getting all package metadata so that users can use the correct information when dealing with package metadata store.
  • Loading branch information
Unity Technologies committed Aug 4, 2021
1 parent b7695d4 commit 32a3ab2
Show file tree
Hide file tree
Showing 9 changed files with 142 additions and 11 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this package will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [4.1.0] - 2021-08-04
### Changes
* Messaging and removing the Lumin platform in 2021.1+. Support is still maintained for Unity 2020 LTS and 2019 LTS.
### Fixes
* Fix [1343655](https://issuetracker.unity3d.com/product/unity/issues/guid/1343655/) by adding an API for getting all package metadata so that users can use the correct information when dealing with package metadata store.

## [4.1.0-pre.2] - 2021-07-26
### Fixes
* More public API changes for [1343655](https://issuetracker.unity3d.com/product/unity/issues/guid/1343655/).
Expand All @@ -14,6 +20,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [4.0.7] - 2021-07-01
* Fixed an issue where object from deleted asset got reused, when upgrading setting asset
* Fixed an issue where the ProjectSettings folder may not have been created prior to Initialization of settings.

## [4.1.0-exp.1] - 2021-06-29
## Updates
Expand Down
4 changes: 3 additions & 1 deletion Editor/Metadata/KnownPackages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ static List<IXRPackage> InitKnownPackages()
}
});

// This section will get replaced with the RELISH package in the near future.
#if !UNITY_2021_2_OR_NEWER
packages.Add(new KnownPackage() {
metadata = new KnownPackageMetadata(){
packageName = "Magic Leap XR Plugin",
Expand All @@ -120,7 +122,7 @@ static List<IXRPackage> InitKnownPackages()
}
}
});

#endif // !UNITY_2021_2_OR_NEWER

packages.Add(new KnownPackage() {
metadata = new KnownPackageMetadata(){
Expand Down
12 changes: 11 additions & 1 deletion Editor/XRLoaderOrderUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ struct DeprecationInfo

#if UNITY_2021_1_OR_NEWER
static string k_DeprecatedWMRLoaderName = "Windows Mixed Reality";
private static string k_DeprecatedLuminLoaderName = "Magic Leap - Note: Lumin Platform will be deprecated in Unity 2021.2!";
#endif //UNITY_2021_1_OR_NEWER

static bool IsDeprecated(string loaderName)
{
#if UNITY_2021_2_OR_NEWER
if (loaderName == k_DeprecatedWMRLoaderName)
if (loaderName == k_DeprecatedWMRLoaderName || loaderName == k_DeprecatedLuminLoaderName)
return true;
#endif //UNITY_2021_2_OR_NEWER
return false;
Expand All @@ -86,6 +88,14 @@ static void PopulateDeprecationInfo()
EditorGUIUtility.IconContent("console.warnicon.sml").image,
@"Microsoft has transitioned support of Windows MR devices to OpenXR in Unity 2021, and recommends using Unity's OpenXR plugin. As such, this Windows XR plugin is marked as deprecated and will be removed in the 2021.2 release. It will continue to be supported in the 2020 LTS.")
};
s_DeprecationInfo[k_DeprecatedLuminLoaderName] = new DeprecationInfo {
icon = EditorGUIUtility.IconContent("console.warnicon.sml"),
renderContent = new GUIContent("",
EditorGUIUtility.IconContent("console.warnicon.sml").image,
@"Unity 2020 LTS will be the last version of the editor which supports Magic Leap 1.
Developers can continue to build for Magic Leap 1 using Unity 2020 LTS or 2019 LTS.")
};
#endif //UNITY_2021_1_OR_NEWER
}

Expand Down
31 changes: 25 additions & 6 deletions Editor/XRPackageInitializationSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ internal class XRPackageInitializationSettings : ScriptableObject
private static XRPackageInitializationSettings s_PackageSettings = null;
private static object s_Lock = new object();

internal static string s_ProjectSettingsAssetName = "XRPackageSettings.asset";
internal static string s_ProjectSettingsFolder = "../ProjectSettings";
internal static string s_ProjectSettingsPath;
internal static string s_PackageInitPath;


[SerializeField]
private List<string> m_Settings = new List<string>();

Expand All @@ -40,13 +46,23 @@ internal static XRPackageInitializationSettings Instance
}
}

internal void LoadSettings()
void InitPaths()
{
if (String.IsNullOrEmpty(s_ProjectSettingsPath)) s_ProjectSettingsPath = Path.Combine(Application.dataPath, s_ProjectSettingsFolder);
if (String.IsNullOrEmpty(s_PackageInitPath)) s_PackageInitPath = Path.Combine(s_ProjectSettingsPath, s_ProjectSettingsAssetName);
}

void OnEnable()
{
string packageInitPath = Path.Combine("ProjectSettings", "XRPackageSettings.asset");
InitPaths();
}

if (File.Exists(packageInitPath))
internal void LoadSettings()
{
InitPaths();
if (File.Exists(s_PackageInitPath))
{
using (StreamReader sr = new StreamReader(packageInitPath))
using (StreamReader sr = new StreamReader(s_PackageInitPath))
{
string settings = sr.ReadToEnd();
JsonUtility.FromJsonOverwrite(settings, this);
Expand All @@ -57,8 +73,11 @@ internal void LoadSettings()

internal void SaveSettings()
{
string packageInitPath = Path.Combine("ProjectSettings", "XRPackageSettings.asset");
using (StreamWriter sw = new StreamWriter(packageInitPath))
InitPaths();
if (!Directory.Exists(s_ProjectSettingsPath))
Directory.CreateDirectory(s_ProjectSettingsPath);

using (StreamWriter sw = new StreamWriter(s_PackageInitPath))
{
string settings = JsonUtility.ToJson(this, true);
sw.Write(settings);
Expand Down
2 changes: 2 additions & 0 deletions Samples~/Editor/SampleMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ class SamplePackageMetadata : IXRPackageMetadata
supportedBuildTargets = new List<BuildTargetGroup>() {
BuildTargetGroup.Android,
BuildTargetGroup.iOS,
#if !UNITY_2021_2_OR_NEWER
BuildTargetGroup.Lumin
#endif
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions Tests/Editor/BuildTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ public void CheckGraphicsAPICompatibilityOnBuild()
[TestFixture(BuildTargetGroup.Standalone)]
[TestFixture(BuildTargetGroup.Android)]
[TestFixture(BuildTargetGroup.iOS)]
#if (!UNITY_2021_2_OR_NEWER)
[TestFixture(BuildTargetGroup.Lumin)]
#endif
[TestFixture(BuildTargetGroup.PS4)]
class XRGeneralSettingsBuildTests
{
Expand Down
78 changes: 78 additions & 0 deletions Tests/Editor/PackageInitSettingsTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
using NUnit.Framework;

using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.XR.Management;
using UnityEngine.XR.Management.Tests;

using Unity.XR.TestTooling;

namespace UnityEditor.XR.Management.Tests
{
class PackageInitSettingsTests
{
string oldAssetName;
string oldFolderName;
string oldSettingsPath;
string oldPackageInitPath;

string tempFolderName;

[SetUp]
public void SetUp()
{
oldAssetName = XRPackageInitializationSettings.s_ProjectSettingsAssetName;
oldFolderName = XRPackageInitializationSettings.s_ProjectSettingsFolder;
oldSettingsPath = XRPackageInitializationSettings.s_ProjectSettingsPath;
oldPackageInitPath = XRPackageInitializationSettings.s_PackageInitPath;

tempFolderName = $"Temp{DateTime.Now.Ticks}";

XRPackageInitializationSettings.s_ProjectSettingsAssetName = "test.asset";
XRPackageInitializationSettings.s_ProjectSettingsFolder = $"{tempFolderName}/ProjectSettings";
XRPackageInitializationSettings.s_ProjectSettingsPath = "";
XRPackageInitializationSettings.s_PackageInitPath = "";

}

[TearDown]
public void TearDown()
{
AssetDatabase.DeleteAsset($"Assets/{tempFolderName}");
XRPackageInitializationSettings.s_ProjectSettingsAssetName = oldAssetName;
XRPackageInitializationSettings.s_ProjectSettingsFolder = oldFolderName;
XRPackageInitializationSettings.s_ProjectSettingsPath = oldSettingsPath;
XRPackageInitializationSettings.s_PackageInitPath = oldPackageInitPath;
}

[Test]
public void TestSettingsSave()
{
Assert.IsTrue(String.IsNullOrEmpty(XRPackageInitializationSettings.s_ProjectSettingsPath));
Assert.IsTrue(String.IsNullOrEmpty(XRPackageInitializationSettings.s_PackageInitPath));

Assert.IsFalse(Directory.Exists(XRPackageInitializationSettings.s_ProjectSettingsPath));
Assert.IsFalse(File.Exists(XRPackageInitializationSettings.s_PackageInitPath));

XRPackageInitializationSettings.Instance.AddSettings("TestTestTest");
Assert.IsTrue(XRPackageInitializationSettings.Instance.HasSettings("TestTestTest"));

XRPackageInitializationSettings.Instance.SaveSettings();

Assert.IsTrue(Directory.Exists(XRPackageInitializationSettings.s_ProjectSettingsPath));
Assert.IsTrue(File.Exists(XRPackageInitializationSettings.s_PackageInitPath));

XRPackageInitializationSettings.Instance.AddSettings("AgainTestTestTest");

XRPackageInitializationSettings.Instance.LoadSettings();

Assert.IsFalse(XRPackageInitializationSettings.Instance.HasSettings("AgainTestTestTest"));
Assert.IsTrue(XRPackageInitializationSettings.Instance.HasSettings("TestTestTest"));
}
}

}
11 changes: 11 additions & 0 deletions Tests/Editor/PackageInitSettingsTests.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "com.unity.xr.management",
"displayName": "XR Plugin Management",
"version": "4.1.0-pre.2",
"version": "4.1.0",
"unity": "2019.4",
"unityRelease": "15f1",
"description": "Package that provides simple management of XR plug-ins. Manages and offers help with loading, initialization, settings, and build support for XR plug-ins.",
Expand All @@ -24,10 +24,10 @@
"repository": {
"url": "https://github.cds.internal.unity3d.com/unity/xr.sdk.management.git",
"type": "git",
"revision": "dfcdcda96f32e3ce8642269e7adfc633bb0e57b0"
"revision": "9b85c8cea3fedb70fbf7716d4db31a29b8d20f98"
},
"upmCi": {
"footprint": "98c65deb81b1ee885bf7bf78f19f27f26ec4c056"
"footprint": "f816858232d682b117c7893450e73761beb58ba2"
},
"samples": [
{
Expand Down

0 comments on commit 32a3ab2

Please sign in to comment.