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

Commit

Permalink
Check whether root profile exists (#695)
Browse files Browse the repository at this point in the history
  • Loading branch information
FejZa authored Nov 24, 2020
1 parent a54e9ee commit da51656
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions Editor/PackageInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,20 +139,33 @@ private static void AddConfigurations(List<string> profiles)

if (platformConfigurationProfile.IsNull()) { continue; }

var rootProfile = MixedRealityToolkit.IsInitialized
? MixedRealityToolkit.Instance.ActiveProfile
: ScriptableObjectExtensions.GetAllInstances<MixedRealityToolkitRootProfile>()[0];

if (EditorUtility.DisplayDialog("We found a new Platform Configuration",
$"We found the {platformConfigurationProfile.name.ToProperCase()}. Would you like to add this platform configuration to your {rootProfile.name}?",
"Yes, Absolutely!",
"later"))
MixedRealityToolkitRootProfile rootProfile;
if (MixedRealityToolkit.IsInitialized)
{
InstallConfiguration(platformConfigurationProfile, rootProfile);
rootProfile = MixedRealityToolkit.Instance.ActiveProfile;
}
else
{
EditorUtility.DisplayDialog("Attention!", "Each data provider will need to be manually registered in each service configuration.", "OK");
var availableRootProfiles = ScriptableObjectExtensions.GetAllInstances<MixedRealityToolkitRootProfile>();
rootProfile = availableRootProfiles.Length > 0 ? availableRootProfiles[0] : null;
}

// Only if a root profile is available at all it makes sense to display the
// platform configuration import dialog. If the user does not have a root profile yet,
// for whatever reason, there is nothing we can do here.
if (rootProfile.IsNull())
{
if (EditorUtility.DisplayDialog("We found a new Platform Configuration",
$"We found the {platformConfigurationProfile.name.ToProperCase()}. Would you like to add this platform configuration to your {rootProfile.name}?",
"Yes, Absolutely!",
"later"))
{
InstallConfiguration(platformConfigurationProfile, rootProfile);
}
else
{
EditorUtility.DisplayDialog("Attention!", "Each data provider will need to be manually registered in each service configuration.", "OK");
}
}
}
}
Expand Down

0 comments on commit da51656

Please sign in to comment.