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

Commit

Permalink
Fix to resolve issue where an error is generated if the MixedRealityT…
Browse files Browse the repository at this point in the history
…oolkit 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 <hodgson.designs@gmail.com>
  • Loading branch information
SimonDarksideJ and StephenHodgson committed Dec 22, 2020
1 parent 99821e9 commit 2d54be7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Editor/PackageInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,13 @@ private static void AddConfigurations(List<string> profiles)
{
AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);

//Clear the selection to ensure the inspector does not cause errors, Empty try catch to avoid Unity crashing when Selection is null
try
{
Selection.activeObject = null;
}
catch { }

foreach (var profile in profiles.Where(x => x.EndsWith(".asset")))
{
var platformConfigurationProfile = AssetDatabase.LoadAssetAtPath<MixedRealityPlatformServiceConfigurationProfile>(profile);
Expand Down Expand Up @@ -193,6 +200,13 @@ private static string CopyAsset(this string rootPath, string sourceAssetPath, st
/// <param name="rootProfile">The root profile to install the </param>
public static void InstallConfiguration(MixedRealityPlatformServiceConfigurationProfile platformConfigurationProfile, MixedRealityToolkitRootProfile rootProfile)
{
//Clear the selection to ensure the inspector does not cause errors, Empty try catch to avoid Unity crashing when Selection is null
try
{
Selection.activeObject = null;
}
catch { }

foreach (var configuration in platformConfigurationProfile.Configurations)
{
var configurationType = configuration.InstancedType.Type;
Expand Down

0 comments on commit 2d54be7

Please sign in to comment.