GUI Text は、画面座標にインポートしたフォントのテキストを表示します。
注意: このコンポーネントは、UI テクスチャと画像とスクリーンに描画する古い方法です。アップデートされた UI system を代わりに使用することを推奨します。これは、IMGUI システムと関連はありません。
プロパティ | 機能 |
---|---|
Text | 表示される文字列 |
Anchor | Text が Transform と位置を共有する地点 |
Alignment | GUIText 内で複数行を配置する方法 |
Pixel Offset | 画面上の GUIText 位置に対するテキストの相対位置のオフセット |
Line Spacing | Text の行間の大きさ |
Tab Size | タブ文字 (‘\t’) のスペース文字の大きさです、スペース文字の幅を 1 単位とした倍数値で表します |
Font | テキストのレンダリングに使用する フォント |
Material | 描画する文字を含む Material への参照です。設定した場合、このプロパティの値でフォントアセットのプロパティの値を上書きします |
Font Size | 使用するフォントサイズです。0 の場合、デフォルトサイズが設定され、ダイナミックフォントの場合のみ適用されます |
Font Style | 使用するフォントスタイル (Normal,Bold,Italic,Bold,Italic)、ダイナミックフォントの場合のみ適用されます。 |
Pixel Correct | オンにすると、すべての Text の文字はインポートされたフォントテクスチャのサイズで描画され、オフにすると、トランスフォームの Scale に基づいてリサイズされます |
Rich Text | オンにすると、テキストの整形に HTML スタイルのタグが使えます |
GUI Text は 2D の画面上にテキストを描画します。テキストを描画するには Camera コンポーネントを持つゲームオブジェクトに GUI レイヤー(旧) をアタッチしなければいけません。デフォルトでカメラには GUI Layer がアタッチされているので、削除しない限りは GUI Text が画面に表示されます。GUI Text は X 軸と Y 軸を使って位置づけされています。ワールド座標の位置というよりも、スクリーン座標で位置づけがされており、(0,0) は左下隅、(1,1) は右上隅となります。Unity 5 で GUIText コンポーネントをアタッチするには、まず空のゲームオブジェクトを作成し( GameObject->Create Empty )、Component->Rendering->GUIText を選択します。もし、テキストが見えない場合は、Transform の位置を (0.5, 0.5, 0.0) にして中心へ表示するようにしてみてください。
フォントのインポートに関しては、フォント を参照してください。
リッチテキストを使用するには リッチテキスト を参照してください。
デフォルトでは、GUI テキストは、Pixel Correct を有効にすることでレンダリングされます。これにより、GUI テキストが鮮明になり、画面の解像度に関係なく、ピクセルで同じサイズのままになります。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.