Skip to content
This repository was archived by the owner on Aug 11, 2024. It is now read-only.

Commit 2d54be7

Browse files
Fix to resolve issue where an error is generated if the MixedRealityToolkit is selected when a configuration is applied. (#735)
* Fix to resolve issue where an error is generated if the MixedRealityToolkit is selected when a configuration is applied. * Added comment around change Co-authored-by: Stephen Hodgson <[email protected]>
1 parent 99821e9 commit 2d54be7

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

Editor/PackageInstaller.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,13 @@ private static void AddConfigurations(List<string> profiles)
133133
{
134134
AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
135135

136+
//Clear the selection to ensure the inspector does not cause errors, Empty try catch to avoid Unity crashing when Selection is null
137+
try
138+
{
139+
Selection.activeObject = null;
140+
}
141+
catch { }
142+
136143
foreach (var profile in profiles.Where(x => x.EndsWith(".asset")))
137144
{
138145
var platformConfigurationProfile = AssetDatabase.LoadAssetAtPath<MixedRealityPlatformServiceConfigurationProfile>(profile);
@@ -193,6 +200,13 @@ private static string CopyAsset(this string rootPath, string sourceAssetPath, st
193200
/// <param name="rootProfile">The root profile to install the </param>
194201
public static void InstallConfiguration(MixedRealityPlatformServiceConfigurationProfile platformConfigurationProfile, MixedRealityToolkitRootProfile rootProfile)
195202
{
203+
//Clear the selection to ensure the inspector does not cause errors, Empty try catch to avoid Unity crashing when Selection is null
204+
try
205+
{
206+
Selection.activeObject = null;
207+
}
208+
catch { }
209+
196210
foreach (var configuration in platformConfigurationProfile.Configurations)
197211
{
198212
var configurationType = configuration.InstancedType.Type;

0 commit comments

Comments
 (0)