7
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

unity > RectTransform > scriptでheight, width を設定する > .sizeDelta = new Vector2 (100.0f, 30.0f);

Last updated at Posted at 2015-09-11
動作確認
Unity 5.2.0f3 on MacOS X 10.8.5

RectTransformのインスペクタで見られるheight, width(下図)をscriptから設定する。

Main_unity_-150911-textNearPanel-PC__Mac___Linux_Standalone__Personal__と_新規投稿-_Qiita.jpg

以下で BottomLeftText (UI > Text型)のwidth=100, height=30にできる。

RectTransform textRect = BottomLeftText.GetComponent<RectTransform> ();
textRect.sizeDelta = new Vector2 (100.0f, 30.0f);

参考
answers.unity3d

7
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?