/** Is an entity visible? */
UENUM(BlueprintType)
enum class ESlateVisibility : uint8
{
/** Visible and hit-testable (can interact with cursor). Default value. */
Visible,
/** Not visible and takes up no space in the layout (obviously not hit-testable). */
Collapsed,
/** Not visible but occupies layout space (obviously not hit-testable). */
Hidden,
/** Visible but not hit-testable (cannot interact with cursor) and children in the hierarchy (if any) are also not hit-testable. */
HitTestInvisible UMETA(DisplayName = "Not Hit-Testable (Self & All Children)"),
/** Visible but not hit-testable (cannot interact with cursor) and doesn't affect hit-testing on children (if any). */
SelfHitTestInvisible UMETA(DisplayName = "Not Hit-Testable (Self Only)")
};
枚举值 | 是否可见 | 在布局中占据空间 | 是否可交互 |
---|---|---|---|
Visible | √ | √ | √ |
Collapsed | × | × | × |
Hidden | × | √ | × |
HitTestInvisible | √ | √ | × |
SelfHitTestInvisible | √ | √ | × |
HitTestInvisible和SelfHitTestInvisible 的区别在于:
- SelfHitTestInvisible:仅该控件自身不可交互,不影响其子控件
- HitTestInvisible:该控件自身及其所有子控件都不可交互
UI可见和隐藏时的一般情况:
- 一般 UI 隐藏时应使用 Collapsed,而不是 Hidden
- 一般 UI 控件可见,其可交互时使用 Visible,不可交互时使用 SelfHitTestInvisible