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

Commit

Permalink
Fixed the nre with the controller mapping winow (#561)
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenHodgson authored May 4, 2020
1 parent 3da47f8 commit 9eaed34
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Editor/ControllerPopupWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ private void OnFocus()
currentControllerTexture = ControllerMappingLibrary.GetControllerTexture(controllerDataProviderProfile);
}

/// <summary>
/// Shows the controller pop out window using the provided profile and serialized interaction mapping property
/// </summary>
/// <param name="profile"></param>
/// <param name="interactionMappingProfiles"></param>
public static void Show(MixedRealityControllerMappingProfile profile, SerializedProperty interactionMappingProfiles)
{
var handednessTitleText = profile.Handedness != Handedness.None ? $"{profile.Handedness} Hand " : string.Empty;
Expand All @@ -86,8 +91,14 @@ public static void Show(MixedRealityControllerMappingProfile profile, Serialized
window.Close();
}

window = (ControllerPopupWindow)CreateInstance(typeof(ControllerPopupWindow));
if (profile.ControllerType?.Type == null)
{
Debug.LogError($"No controller type defined for {profile.name}");
return;
}

window.currentControllerName = profile.ControllerType.Type.Name;
window = (ControllerPopupWindow)CreateInstance(typeof(ControllerPopupWindow));

window.titleContent = new GUIContent($"{window.currentControllerName} {handednessTitleText}Input Action Assignment");
window.controllerDataProviderProfile = profile;
Expand Down

0 comments on commit 9eaed34

Please sign in to comment.