dev-resources.site
for different kinds of informations.
uGUI
Published at
12/25/2021
Categories
unity3d
ugui
Author
Hiromichi Yamada
Main Article
RectTransformのLeft,Right,Top,Bottomをスクリプトから変更する方法.
http://answers.unity.com/answers/1610964/view.html
using UnityEngine;
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);
}
}
Articles
12 articles in total
uGUI
currently reading
AppSheet リンク
read article
Direct URL to Image in Google Drive
read article
Redirect to HTTPS
read article
WordPress Plugins
read article
macOS シェルのPATH追加設定
read article
For M1 MacBook Pro
read article
Git LFS 手順
read article
Unity Debug Print
read article
mldbを使えるようにするセットアップ手順
read article
AutoHotKeyの使い方メモ
read article
Fade in/out in Unity Timeline
read article
Featured ones: