You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
608 B
27 lines
608 B
using UnityEngine; |
|
|
|
namespace Utils |
|
{ |
|
public static class RectTransformExtensions { |
|
|
|
public static void SetLeft(this RectTransform rt, float left) |
|
{ |
|
rt.offsetMin = new Vector2(left, rt.offsetMin.y); |
|
} |
|
|
|
public static void SetRight(this RectTransform rt, float right) |
|
{ |
|
rt.offsetMax = new Vector2(-right, rt.offsetMax.y); |
|
} |
|
|
|
public static void SetTop(this RectTransform rt, float top) |
|
{ |
|
rt.offsetMax = new Vector2(rt.offsetMax.x, -top); |
|
} |
|
|
|
public static void SetBottom(this RectTransform rt, float bottom) |
|
{ |
|
rt.offsetMin = new Vector2(rt.offsetMin.x, bottom); |
|
} |
|
} |
|
}
|
|
|