UISizeConstraint

사용되지 않는 항목 표시

The UISizeConstraint ensures a GuiObject does not become larger or smaller than the UISizeConstraint.MaxSize and UISizeConstraint.MinSize.

For example, if the MaxSize is set to {200, 200} and the MinSize is set to {100, 100}, then the constrained GuiObject cannot scale to be larger than 200 pixels wide and 200 pixels tall or smaller than 100 pixels wide and 100 pixels tall.

If the object with this constraint is also under the control of a UILayout such as UIGridLayout, then the constraint determines the objects size and overwrites any size the layout would apply.

A UISizeConstraint can be applied to a GuiObject by parenting it to that object.

코드 샘플

Creating a GUI With a UISizeConstraint

local StarterGui = game:GetService("StarterGui")
local screenGui = Instance.new("ScreenGui")
screenGui.Parent = StarterGui
local frame = Instance.new("Frame")
frame.Size = UDim2.new(0, 400, 0, 400)
frame.Parent = screenGui
local constraint = Instance.new("UISizeConstraint")
constraint.MaxSize = Vector2.new(250, 250)
constraint.MinSize = Vector2.new(50, 50)
constraint.Parent = frame

요약

속성

  • 병렬 읽기

    The largest size in pixels the object is allowed to be.

  • 병렬 읽기

    The smallest size in pixels the object is allowed to be.

속성

MaxSize

병렬 읽기

The largest size in pixels the object is allowed to be. The X and Y of this value must be greater than or equal to the corresponding components of UISizeConstraint.MinSize.

MinSize

병렬 읽기

The smallest size in pixels the object is allowed to be. The X and Y of this value must be less than or equal to the corresponding components of UISizeConstraint.MaxSize.

메서드

이벤트