From 9f38fb3a61357288e43567c59230c8af53411f0a Mon Sep 17 00:00:00 2001 From: Dino Fejzagic Date: Fri, 19 Jun 2020 13:45:26 +0200 Subject: [PATCH] Fix profiles reset and services reinitialized when already running (#646) --- .../com.xrtk.core/Runtime/Services/MixedRealityToolkit.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/XRTK-Core/Packages/com.xrtk.core/Runtime/Services/MixedRealityToolkit.cs b/XRTK-Core/Packages/com.xrtk.core/Runtime/Services/MixedRealityToolkit.cs index 2d7f02012..d1e3953aa 100644 --- a/XRTK-Core/Packages/com.xrtk.core/Runtime/Services/MixedRealityToolkit.cs +++ b/XRTK-Core/Packages/com.xrtk.core/Runtime/Services/MixedRealityToolkit.cs @@ -92,6 +92,14 @@ public MixedRealityToolkitRootProfile ActiveProfile /// public void ResetProfile(MixedRealityToolkitRootProfile profile) { + if (Application.isEditor && Application.isPlaying) + { + // The application is running in editor play mode, can't + // reset profiles in this state as it will cause destruction + // and reinitialization of services in use. + return; + } + if (isResetting) { Debug.LogWarning("Already attempting to reset the root profile!");