3
4

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.

uGUIでテキスト量に合わせた領域サイズを取得する

Posted at

前提

・テキストの量からダイアログを可変にしたい状況
・テキストの表示領域サイズを求められれば、ダイアログのサイズも決定できそう!

テキスト領域サイズの取得について

①TextコンポーネントのあるGameObjectへContentSizeFitterコンポーネントを追加する
b8f2c183-88f1-f5c8-ae6b-af470c5160fd.png
と、テキスト量によってサイズが決まるようになる。

入力を変えてみる

cf0dddd4-c484-3fed-7d5a-e88978ab77b9.png

これでダイアログからテキストがはみ出さないようにできそう。

参考

Unity ContentSizeFitterコンポーネントの使い方例
http://qiita.com/cchocor/items/2e401fd286d0576c25d1

3
4
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
3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?