Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
## [3.0.5] - 2019-12-06
* Fix package validation errors.
* Release for verification.

## [3.0.5-preview.4] - 2019-12-06
* Release for verification.
* Remove build target filtering support. Will be added back into 3.1.0.

## [3.0.5-preview.3] - 2019-11-22
* Correct Samples code to make sure that it compiles correctly.
* Make some documentation fixes for inline code.
* Replace XR SDK text with just XR or other appropriate messaging.

## [3.0.5-preview.2] - 2019-11-18
* New attribute was incorrectly placed into Runtime instead of Editor. Moved to Editor where it belongs.
  • Loading branch information
Unity Technologies committed Dec 5, 2019
1 parent 61cecab commit 08e124f
Show file tree
Hide file tree
Showing 18 changed files with 58 additions and 143 deletions.
24 changes: 22 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,30 @@ 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).


## [3.0.5] - 2019-12-06
* Fix package validation errors.
* Release for verification.

## [3.0.5-preview.4] - 2019-12-06
* Release for verification.
* Remove build target filtering support. Will be added back into 3.1.0.

## [3.0.5-preview.3] - 2019-11-22
* Correct Samples code to make sure that it compiles correctly.
* Make some documentation fixes for inline code.
* Replace XR SDK text with just XR or other appropriate messaging.

## [3.0.5-preview.2] - 2019-11-18
* New attribute was incorrectly placed into Runtime instead of Editor. Moved to Editor where it belongs.

## [3.0.5-preview.1] - 2019-11-13
* UI rework to provide for simpler installation and management of XR Plugin Providers.
* Reworked the underlying data handling and maintenance to be more streamlines and less coupled.

## [3.0.4] - 2019-11-04
* Release package for verification.

## [3.0.4-preview.3] - 2019-10-29
* Update minimum compatible Editor version to 2019.3.0b9
* Fixes an issue where subsystems could not be initialized before awake in the editor
Expand All @@ -34,7 +54,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
* Change legacy input helpers version to 1.*
* Fix documentation validation errors.
* Allow 3.x to work with Unity 2019.2.
* This package will not work with 2019.3a1 - a11.
* This package will not work with 2019.3a1 - a11.

## [3.0.2-preview.1] - 2019-08-06
* Remove asset menu creation entry for XR Settings as it is unsupported now.
Expand Down Expand Up @@ -210,4 +230,4 @@ Added code to auto create the first SO settings instance using a file panel sinc

## [0.1.0-preview.1] - 2018-06-21

### This is the first release of *Unity Package XR SDK Management*.
### This is the first release of *Unity Package XR Management*.
8 changes: 4 additions & 4 deletions Documentation~/EndUser.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ At package install time, the package may prompt you to create an instance of a l

If you wish not to create this at installation time, the appropriate portion of the editor that require them (**XRManagerSettings** and **Unified Settings** will) prompt you to create them as well.

**NOTE**: You can always manually control the XR SDK system by accessing the **XRGeneralSettings.Instance.Manager.activeLoader** field once XR SDK has been initialized.
**NOTE**: You can always manually control the XR system by accessing the **XRGeneralSettings.Instance.Manager.activeLoader** field once XR has been initialized.

## Add plugin loaders as needed
* Navigate to **Project Settings**.
Expand All @@ -25,7 +25,7 @@ If you wish not to create this at installation time, the appropriate portion of
### Automatic manager loading of XR
By default XR Management will automatically initialize and start your XR environment on application load. At runtime this happens immediately before first scene load. In Play mode this happens immediately after first scene load but before Start is called on your game objects. In either case XR should be setup before Start is called so you should be able to query the state of XR in the Start method of your game objects.

### If you wish to start XR SDK on a per scene basis (i.e. start in 2D and transition into VR)
### If you wish to start XR on a per scene basis (i.e. start in 2D and transition into VR)
* Make sure you disable the **Initialize on Startup** toggle for each platform you support.
* At runtime use the **XRGeneralSettings.Instance.Manager** to add/create, remove and reorder the loaders you wish to use from the script.
* To setup the XR environment to run manually call **InitializeLoader(Async)** on the **XRGeneralSettings.Instance.Manager**.
Expand All @@ -37,9 +37,9 @@ By default XR Management will automatically initialize and start your XR environ

Any package that needs build or runtime settings should provide a settings datatype for use. This will be surfaced in the **Unified Settings** UI window underneath a top level **XR** node. By default a custom settings data instance will not be created. If you wish to modify build or runtime settings for the package you must go to the package authors entry in **Unified Settings** and select **Create**. This will create an instance of the settings that you can then modify inside of **Unified Settings**.

# Installing *XR SDK Management*
# Installing *XR Management*

Most likey the XR SDK Provider package you want to use already includes XR Management so you shouldn't need to install it. If you do you can follow the directions provided in the top level documentation or follow the instructions in the [Package Manager documentation](https://docs.unity3d.com/Packages/com.unity.package-manager-ui@latest/index.html).
Most likey the XR Provider package you want to use already includes XR Management so you shouldn't need to install it. If you do you can follow the directions provided in the top level documentation or follow the instructions in the [Package Manager documentation](https://docs.unity3d.com/Packages/com.unity.package-manager-ui@latest/index.html).

# Installing *Legacy Input Helpers*

Expand Down
12 changes: 6 additions & 6 deletions Documentation~/Provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

## Lifecycle Management

This package provides for management of **XR SDK** subsystem lifecycle without the need for boilerplate code. The **XRManagerSettings** class provides a scriptable object that can be used by the app for start, stop and de-initialization of a set of subsystems defined by an **XRLoader** instance.
This package provides for management of **XR** subsystem lifecycle without the need for boilerplate code. The **XRManagerSettings** class provides a scriptable object that can be used by the app for start, stop and de-initialization of a set of subsystems defined by an **XRLoader** instance.

A provider must create a subclass of **XRLoader** to make a loader available for their particular runtime scheme.

The **XRLoader** interface looks like this:

```csharp
```
public abstract class XRLoader : ScriptableObject
{
public virtual bool Initialize() { return false; }
Expand Down Expand Up @@ -55,7 +55,7 @@ A provider may need optional settings to help manage build issues or runtime con

The provider will need to handle getting the settings from **EditorUserBuildSettings** into the build application. This can be done with a custom build processing script. If all you need for build support is to make sure that you have access to the same settings at runtime you can derive from **XRBuildHelper<T>**. This is a generic abstract base class that handles the necessary work of getting the build settings stored in EditorUserBuildSettings and getting them into the build application for access at runtime. Simplest build script for your package would look like this:

```csharp
```
public class MyBuildProcessor : XRBuildHelper<MySettings>
{
public override string BuildSettingsKey { get { return "MyPackageSettingsKey"; } }
Expand All @@ -64,7 +64,7 @@ public class MyBuildProcessor : XRBuildHelper<MySettings>

You can override the build processing steps from **IPreprocessBuildWithReport** and **IPostprocessBuildWithReport** but make sure that you call to the base class implementation or else your settings will not be copied.

```csharp
```
public class MyBuildProcessor : XRBuildHelper<MySettings>
{
public override string BuildSettingsKey { get { return "MyPackageSettingsKey"; } }
Expand All @@ -85,7 +85,7 @@ public class MyBuildProcessor : XRBuildHelper<MySettings>

If you wish to support per platform settings at build time, you can override `UnityEngine.Object SettingsForBuildTargetGroup(BuildTargetGroup buildTargetGroup)` and use the passed in buildTargetGroup to retrieve the appropriate platform settings. By default this method just uses the key associated with the settings instance to copy the entire settings object from EditorUserBuildSettings to PlayerSettings.

```csharp
```
public class MyBuildProcessor : XRBuildHelper<MySettings>
{
public override string BuildSettingsKey { get { return "MyPackageSettingsKey"; } }
Expand All @@ -111,6 +111,6 @@ If you need more extensive support and/or absolute control you can copy the **Sa

Given the need for **ScriptableObject** instance to support loaders and settings, the user will be forced to create these instances at some point. Both **XRManagerSettings** and the **Unified Settings** support can handle creating the necessary instances on demand but it may be beneficial to create these up front at package installation. If you derive a class from **XRPackageInitializationBase** and fill out the interface properties and methods the management system will provide for creation of default instances of your loader and settings at installation. Creation of each one is driven by prompting the user if it is OK to do that and, if so, creating the instance in the appropriate default location in the Assets folder. For loaders this is Assets/XR/Loaders. For settings this is Assets/XR/Settings. While these are the recommended locations for putting these package based objects they do not have to be located there. The user is free to move them around as long as we can find at least one instance of each type for each package.

# Installing *XR SDK Management*
# Installing *XR Management*

To install this package, follow the instructions in the [Package Manager documentation](https://docs.unity3d.com/Packages/com.unity.package-manager-ui@latest/index.html).
14 changes: 7 additions & 7 deletions Documentation~/com.unity.xr.management.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# About *XR SDK Management* package
# About *XR Management* package

Use the **XR SDK Management** package to help streamline **XR SDK** lifecycle management and potentially provide users with build time UI through the Unity **Unified Settings** system.
Use the **XR Management** package to help streamline **XR** lifecycle management and potentially provide users with build time UI through the Unity **Unified Settings** system.

# Installation

Expand Down Expand Up @@ -31,9 +31,9 @@ If you want to use a cloned version of the package directly, you can point the P
NOTE: The package root is not necessarily the root of the cloned repo. The package root the folder where the package's package.json file located.


# Using XR SDK Management
# Using XR Management

There are two target audiences for XR SDK Management: The End User and the Provider. Documentation for those can be found here:
There are two target audiences for XR Management: The End User and the Provider. Documentation for those can be found here:

* [End Users Documentation](./EndUser.md)
* [Provider Documentation](./Provider.md)
Expand All @@ -42,7 +42,7 @@ There are two target audiences for XR SDK Management: The End User and the Provi

## Requirements

This version of **XR SDK Management** is compatible with the following versions of the Unity Editor:
This version of **XR Management** is compatible with the following versions of the Unity Editor:

* 2019.1 and later (recommended)

Expand All @@ -52,12 +52,12 @@ This version of **XR SDK Management** is compatible with the following versions

## Package contents

This version of **XR SDK Management** includes:
This version of **XR Management** includes:

* **XRManagerSettings** - This is a **ScriptableObject** that can be accessed from the script and provides for management of **XRLoader** instances and their lifecycle.
* **XRLoader** - This is the base class all loaders should derive from. It provides a basic the **XRManagerSettings** can use to manage lifecycle and a simple API to allow users to request specific subsystems from the loader as and when needed.
* **XRConfigurationData** - This is an attribute that allows for build and runtime settings to be hosted within the **Unified Settings** window. All instances will be hosted under the top level **XR** entry within the **Unified Settings** window under the name supplied as part of the attribute. The management package will maintain and manage the lifecycle for one instance of the build settings using **EditorBuildSettings** config object API, stored with the key provided in the attribute. At any time, the provider or the user is free access the configuration settings instance by asking **EditorBuildSettings** for the instance associated with the chosen key (as set in the attribute).
* **XRPackageInitializationBase** - Helper class to derive from that simplifies some of the busy work for package initialization. Helps to create a default instance of the packages XRLoader and default settings at the time of package installation. Initialization is run once only and the package developer should not depend on the user creating the specified instances.
* **XRBuildHelper** - Abstract class useful for handling some boilerplate around moving settings from Editor -> Runtime. Derive from this class and specific the appropriate settings type and the system will take care of marshaling that type from EditorUserBuildSettings to PlayerSettings to be used at runtime.
* **XRGeneralSettings** - Contains settings specific to all of XR SDK and not to any single provider.
* **XRGeneralSettings** - Contains settings specific to all of XR and not to any single provider.
* **Samples** - There is a samples folder in the package that contains an implementation of all parts of XR Management. Copy that folder to a location in your project/package to get started with implementing XR Management for your needs.
50 changes: 1 addition & 49 deletions Editor/XRLoaderInfoManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public SerializedObject SerializedObjectData
}

List<XRLoaderInfo> m_AllLoaderInfos = new List<XRLoaderInfo>();
List<XRLoaderInfo> m_AllLoaderInfosForBuildTarget = new List<XRLoaderInfo>();
List<XRLoaderInfo> m_AssignedLoaderInfos = new List<XRLoaderInfo>();
List<XRLoaderInfo> m_UnassignedLoaderInfos = new List<XRLoaderInfo>();

Expand Down Expand Up @@ -126,7 +125,6 @@ public void ReloadData()
return;

PopulateAllLoaderInfos();
PopulateLoadersForBuildTarget();
PopulateAssignedLoaderInfos();
PopulateUnassignedLoaderInfos();

Expand Down Expand Up @@ -177,15 +175,10 @@ string AssetNameFromInstance(UnityEngine.Object asset)
return Path.GetFileNameWithoutExtension(assetPath);
}

void PopulateLoadersForBuildTarget()
{
m_AllLoaderInfosForBuildTarget = FilteredLoaderInfos(m_AllLoaderInfos);
}

void PopulateUnassignedLoaderInfos()
{
m_UnassignedLoaderInfos.Clear();
foreach (var info in m_AllLoaderInfosForBuildTarget)
foreach (var info in m_AllLoaderInfos)
{
var assigned = from ai in m_AssignedLoaderInfos where ai.loaderType == info.loaderType select ai;
if (!assigned.Any()) m_UnassignedLoaderInfos.Add(info);
Expand All @@ -197,47 +190,6 @@ void PopulateProperty(string propertyPath, ref SerializedProperty prop)
if (SerializedObjectData != null && prop == null) prop = SerializedObjectData.FindProperty(propertyPath);
}

private List<XRLoaderInfo> FilteredLoaderInfos(List<XRLoaderInfo> loaderInfos)
{
List<XRLoaderInfo> ret = new List<XRLoaderInfo>();

foreach (var info in loaderInfos)
{
if (info.loaderType == null)
continue;

object[] attrs;

try
{
attrs = info.loaderType.GetCustomAttributes(typeof(XRSupportedBuildTargetAttribute), true);
}
catch (Exception)
{
attrs = default;
}

if (attrs.Length == 0)
{
// If unmarked we assume it will be applied to all build targets.
ret.Add(info);
}
else
{
foreach (XRSupportedBuildTargetAttribute attr in attrs)
{
if (attr.buildTargetGroup == m_BuildTargetGroup)
{
ret.Add(info);
break;
}
}
}
}

return ret;
}

void UpdateSerializedProperty()
{
if (m_LoaderList != null && m_LoaderList.isArray)
Expand Down
2 changes: 1 addition & 1 deletion Editor/XRSettingsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct Content
internal static GUIContent s_ProvidersToInstall = new GUIContent("Installable XR Plugin Providers");
internal static GUIContent s_LookingForProviders = new GUIContent("Looking for installable provider packages... ");
internal static GUIContent s_NoInstallablePackages = new GUIContent("No installable provider packages found.");
internal static string k_NeedToInstallAProvider = "Before you can use the XR system you need to install at least one provider from the list above.";
internal static string k_NeedToInstallAProvider = "Before you can use the XR system you need to install at least one provider from the list.";
internal static string k_ProvidersUnavailable = "We are unable to find any providers usable within Unity at this time. XR is currently unavailable to use.";
internal static GUIContent s_InstallPackage = new GUIContent("Install");
internal static GUIContent s_InstallingPackage = new GUIContent("Installing");
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# XR Management

This package provides for management of **XR SDK** subsystem lifecycles without the need for boilerplate code as well as support for provider specific build settings.
This package provides for management of **XR** subsystem lifecycles without the need for boilerplate code as well as support for provider specific build settings.

This package is primarily intented for XR SDK Package authors to provide management tools and touchpoints for their package users. As such, most end users will have this package installed transitively through install of the end user XR SDK package using it.
This package is primarily intented for XR Package authors to provide management tools and touchpoints for their package users. As such, most end users will have this package installed transitively through install of the end user XR package using it.

## Installing XR Management

Expand Down
6 changes: 3 additions & 3 deletions Runtime/IXRLoaderPreInit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
namespace UnityEngine.XR.Management
{
/// <summary>
/// XRLoader interface for retrieving the XR SDK PreInit library name from an XRLoader instance
/// XRLoader interface for retrieving the XR PreInit library name from an XRLoader instance
/// </summary>
public interface IXRLoaderPreInit
{
/// <summary>
/// Get the library name, if any, to use for XR SDK PreInit.
/// Get the library name, if any, to use for XR PreInit.
/// </summary>
///
/// <param name="buildTarget">An enum specifying which platform this build is for.</param>
/// <param name="buildTargetGroup">An enum specifying which platform group this build is for.</param>
/// <returns>A string specifying the library name used for XR SDK PreInit.</returns>
/// <returns>A string specifying the library name used for XR PreInit.</returns>
string GetPreInitLibraryName(BuildTarget buildTarget, BuildTargetGroup buildTargetGroup);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Runtime/XRConfigurationData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace UnityEngine.XR.Management
{
/// <summary>
/// This attribute is used to tag classes as providing build settings support for an XR SDK provider. The unified setting system
/// This attribute is used to tag classes as providing build settings support for an XR provider. The unified setting system
/// will present the settings as an inspectable object in the Unified Settings window using the built-in inspector UI.
///
/// The implementor of the settings is able to create their own custom UI and the Unified Settings system will use that UI in
Expand Down
Loading

0 comments on commit 08e124f

Please sign in to comment.