Skip to content

Commit 478ffbf

Browse files
author
Christopher - Marcel Böddecker
committed
fix(UICanvas): ghost in layout group
The draggable helper game object the UI Canvas uses interferes with the layout system and shows up as an empty "ghost" object when used in conjunction with a layout group. The fix is to add a `LayoutElement` and setting `ignoreLayout` to true so the layout system ignores that element completely. This fix resolves #925.
1 parent cca33de commit 478ffbf

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Assets/VRTK/Scripts/UI/VRTK_UICanvas.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ private void CreateDraggablePanel(Canvas canvas, Vector2 canvasSize)
118118
{
119119
var draggablePanel = new GameObject(CANVAS_DRAGGABLE_PANEL);
120120
draggablePanel.AddComponent<RectTransform>();
121+
draggablePanel.AddComponent<LayoutElement>().ignoreLayout = true;
121122
draggablePanel.AddComponent<Image>().color = Color.clear;
122123
draggablePanel.AddComponent<EventTrigger>();
123124
draggablePanel.transform.SetParent(canvas.transform);

0 commit comments

Comments
 (0)