From c79b63c5451e5733c698d90e57a9635e6c0aed9e Mon Sep 17 00:00:00 2001 From: Mark Grossnickle Date: Mon, 4 Jun 2018 11:12:00 -0600 Subject: [PATCH 1/2] Keyboard Fix for missing keys There is a bug with the keyboard which causes the first button in each row to not appear or at least be positioned correctly. I forget the exact reasoning behind it as I made this change locally 6 months ago but I believe it had something to do with gameObjects being inactive if you initialized a keyboard and then hid it. In any case, it appears to be unecessary overhead for the layout to update at runtime. --- Assets/HoloToolkit/UX/Scripts/UICollection.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Assets/HoloToolkit/UX/Scripts/UICollection.cs b/Assets/HoloToolkit/UX/Scripts/UICollection.cs index 42e550117aa..316dac4183b 100644 --- a/Assets/HoloToolkit/UX/Scripts/UICollection.cs +++ b/Assets/HoloToolkit/UX/Scripts/UICollection.cs @@ -122,6 +122,7 @@ public void RemoveAllItems() private void CollectItems() { + if (!Application.isEditor) { return; } Items.Clear(); foreach (Transform childTransform in transform) @@ -136,6 +137,7 @@ private void CollectItems() protected virtual void UpdateLayout() { + if (!Application.isEditor) { return; } Rect rect = rectTransform.rect; Vector2 updatedSize = Vector2.zero; From 8d2a15b86151b7246a934e318d016473a7e7b31b Mon Sep 17 00:00:00 2001 From: Mark Grossnickle Date: Mon, 4 Jun 2018 13:48:44 -0600 Subject: [PATCH 2/2] Removed overzealous IsEditor Checks By moving the IsEditor checks to just Start/Update it will allow developers to continue to add/remove items at runtime. --- Assets/HoloToolkit/UX/Scripts/UICollection.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Assets/HoloToolkit/UX/Scripts/UICollection.cs b/Assets/HoloToolkit/UX/Scripts/UICollection.cs index 316dac4183b..1c870568107 100644 --- a/Assets/HoloToolkit/UX/Scripts/UICollection.cs +++ b/Assets/HoloToolkit/UX/Scripts/UICollection.cs @@ -65,6 +65,8 @@ private void Start() // Verify this is attached to a GameObject with a rect transform rectTransform = GetComponent(); + if (!Application.isEditor) { return; } + // Collect children items already added (likely added in the Editor) CollectItems(); UpdateLayout(); @@ -121,8 +123,7 @@ public void RemoveAllItems() } private void CollectItems() - { - if (!Application.isEditor) { return; } + { Items.Clear(); foreach (Transform childTransform in transform) @@ -137,7 +138,6 @@ private void CollectItems() protected virtual void UpdateLayout() { - if (!Application.isEditor) { return; } Rect rect = rectTransform.rect; Vector2 updatedSize = Vector2.zero;