Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
## [4.0.6] - 2021-05-18
### Fixes
* Fix issue where XR was not being started when entering play mode if the settings UI was never displayed.
* Fixed an issue where custom XR packages would not get registered when running the Unity Editor using the [-batchmode](https://docs.unity3d.com/Manual/CommandLineArguments.html) argument.

### Added

* Added additional documentation explaining that manual XR Initialization should only be called from [Start](https://docs.unity3d.com/ScriptReference/MonoBehaviour.Start.html) or later as calling it from [Awake](https://docs.unity3d.com/ScriptReference/MonoBehaviour.Awake.html) or [OnEnable](https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnEnable.html) can cause issues if graphics initialization hasn't finished yet.
  • Loading branch information
Unity Technologies committed May 18, 2021
1 parent 6e839d7 commit 935bfdd
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 16 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ 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.0.6] - 2021-05-18
### Fixes
* Fix issue where XR was not being started when entering play mode if the settings UI was never displayed.
* Fixed an issue where custom XR packages would not get registered when running the Unity Editor using the [-batchmode](https://docs.unity3d.com/Manual/CommandLineArguments.html) argument.

### Added

* Added additional documentation explaining that manual XR Initialization should only be called from [Start](https://docs.unity3d.com/ScriptReference/MonoBehaviour.Start.html) or later as calling it from [Awake](https://docs.unity3d.com/ScriptReference/MonoBehaviour.Awake.html) or [OnEnable](https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnEnable.html) can cause issues if graphics initialization hasn't finished yet.

## [4.0.5] - 2021-05-06
### Fixes
* Fix issue with changelog.
Expand Down
3 changes: 1 addition & 2 deletions Documentation~/EndUser.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ If you want to start XR on a per-Scene basis (for example, to start in 2D and tr

|Method|Description|
|---|---|
|`InitializeLoader(Async)`|Sets up the XR environment to run manually.|
|`InitializeLoader(Async)`|Sets up the XR environment to run manually. Should be called on or after [Start](https://docs.unity3d.com/ScriptReference/MonoBehaviour.Start.html) has finished to avoid conflicts with graphics initialization sequence.|
|`StartSubsystems`|Starts XR and puts your application into XR mode.|
|`StopSubsystems`|Stops XR and takes your application out of XR mode. You can call `StartSubsystems` again to go back into XR mode.|
|`DeinitializeLoader`|Shuts down XR and removes it entirely. You must call `InitializeLoader(Async)` before you can run XR again.|
Expand Down Expand Up @@ -239,7 +239,6 @@ You would most likely place this script in a custom build script, but that isn't

**Note:** A new loader that wasn't known at startup can't be added to the loader list at runtime, which causes the modification operation to fail. You can still modify the list during runtime, whether the app runs in Play mode or as a standalone build.


This means that you are able to do the following during runtime:

- Remove loaders from the list of loaders.
Expand Down
4 changes: 2 additions & 2 deletions Documentation~/com.unity.xr.management.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ There are two target audiences for XR Plug-in Management: the end user and the p

This version of XR Plug-in Management is compatible with the following versions of the Unity Editor:

* 2019.3 and later (recommended)
* 2019.4.15f1 and later

### Known limitations

None.
Attempting to manually initialize XR using [XRManagerSettings.InitializeLoader](https://docs.unity3d.com/Packages/[email protected]/api/UnityEngine.XR.Management.XRManagerSettings.html#UnityEngine_XR_Management_XRManagerSettings_InitializeLoader) from [Awake](https://docs.unity3d.com/ScriptReference/MonoBehaviour.Awake.html) could potentially interfere with graphics initialization. If you wish to manually initialize XR then call `InitializeLoader` from [Start](https://docs.unity3d.com/ScriptReference/MonoBehaviour.Start.html) to ensure the graphics initialization has completed.

### Package contents

Expand Down
1 change: 1 addition & 0 deletions Editor/Metadata/XRPackageMetadataStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ static XRPackageMetadataStore()
{
InitKnownPluginPackages();

EditorApplication.playModeStateChanged -= PlayModeStateChanged;
EditorApplication.playModeStateChanged += PlayModeStateChanged;

if (IsEditorInPlayMode())
Expand Down
13 changes: 7 additions & 6 deletions Editor/XRGeneralSettingsPerBuildTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ public class XRGeneralSettingsPerBuildTarget : ScriptableObject, ISerializationC


#if UNITY_EDITOR

static XRGeneralSettingsPerBuildTarget()
{
EditorApplication.playModeStateChanged -= PlayModeStateChanged;
EditorApplication.playModeStateChanged += PlayModeStateChanged;
}

// Simple class to give us updates when the asset database changes.
class AssetCallbacks : AssetPostprocessor
{
Expand All @@ -49,14 +56,8 @@ static void BeginUpgradeSettings()
}
}

private void OnDisable()
{
EditorApplication.playModeStateChanged -= PlayModeStateChanged;
}

void OnEnable()
{
EditorApplication.playModeStateChanged += PlayModeStateChanged;
foreach (var setting in Settings.Values)
{
var assignedSettings = setting.AssignedSettings;
Expand Down
10 changes: 7 additions & 3 deletions Editor/XRPackageInitialization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,17 @@ class XRPackageInitializationBootstrap
{
static XRPackageInitializationBootstrap()
{
if (!EditorApplication.isPlayingOrWillChangePlaymode)
if (!EditorApplication.isPlayingOrWillChangePlaymode && !Application.isBatchMode)
{
EditorApplication.update += BeginPackageInitialization;
}
else
{
BeginPackageInitialization();
}

EditorApplication.playModeStateChanged -= PlayModeStateChanged;
EditorApplication.playModeStateChanged += PlayModeStateChanged;

}

private static void PlayModeStateChanged(PlayModeStateChange state)
Expand Down Expand Up @@ -126,7 +130,7 @@ static bool InitializePackageFromMetadata(IXRPackage package, IXRPackageMetadata
ret = ret && InitializeSettingsFromMetadata(package, packageMetadata.packageName, packageMetadata.settingsType);
return ret;
}

static bool InitializeLoaderFromMetadata(string packageName, List<IXRLoaderMetadata> loaderMetadatas)
{
if (String.IsNullOrEmpty(packageName))
Expand Down
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.0.5",
"version": "4.0.6",
"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": "59665b284b3b388bea2dcb98a8f3e4748694f3e6"
"revision": "abdf3fbaa4f4cde7145c508df7d60d9ca6f4ecc3"
},
"upmCi": {
"footprint": "a881f9784f5415835b3f235181661038d23b73e2"
"footprint": "d9cbbe0a2f9ce6a9d9d4d44e4c7be43dd0fd8783"
},
"samples": [
{
Expand Down

0 comments on commit 935bfdd

Please sign in to comment.