Fix prefab window to use UI Mode for empty UI Control prefab

#3574
This commit is contained in:
Wojtek Figat
2025-09-13 14:41:11 +02:00
parent a471861e92
commit 9e1f488f22

View File

@@ -112,8 +112,9 @@ namespace FlaxEditor.Viewport.Previews
LinkCanvas(_instance);
// Link UI control to the preview
var uiControl = _instance as UIControl;
if (_uiControlLinked == null &&
_instance is UIControl uiControl &&
uiControl != null &&
uiControl.Control != null &&
uiControl.Control.Parent == null)
{
@@ -128,6 +129,12 @@ namespace FlaxEditor.Viewport.Previews
_uiControlLinked.Control.Parent = _uiParentLink;
_hasUILinked = true;
}
// Use UI mode when root is empty UI Control
if (_uiControlLinked == null && uiControl != null && uiControl.Control == null)
{
_hasUILinked = true;
}
}
private void LinkCanvas(Actor actor)