スクリーンレンダリングのために使用することができる要素
Elements on a canvas are rendered AFTER Scene rendering, either from an attached camera or using overlay mode.
using System.Collections; using System.Collections.Generic; using UnityEditor; using UnityEngine; using UnityEngine.UI;
// Create a Canvas that holds a Text GameObject.
public class ExampleClass : MonoBehaviour { void Start() { GameObject myGO; GameObject myText; Canvas myCanvas; Text text; RectTransform rectTransform;
// Canvas myGO = new GameObject(); myGO.name = "TestCanvas"; myGO.AddComponent<Canvas>();
myCanvas = myGO.GetComponent<Canvas>(); myCanvas.renderMode = RenderMode.ScreenSpaceOverlay; myGO.AddComponent<CanvasScaler>(); myGO.AddComponent<GraphicRaycaster>();
// Text myText = new GameObject(); myText.transform.parent = myGO.transform; myText.name = "wibble";
text = myText.AddComponent<Text>(); text.font = (Font)Resources.Load("MyFont"); text.text = "wobble"; text.fontSize = 100;
// Text position rectTransform = text.GetComponent<RectTransform>(); rectTransform.localPosition = new Vector3(0, 0, 0); rectTransform.sizeDelta = new Vector2(400, 200); } }
additionalShaderChannels | Get or set the mask of additional shader channels to be used when creating the Canvas mesh. |
cachedSortingLayerValue | 選択されたレイヤー ID(SortingLayerID)に基づいてキャッシュされた値が計算されます。 |
isRootCanvas | Canvas がルートかどうか |
normalizedSortingGridSize | キャンバスが分割するレンダリング可能なエリアの正規化されたグリッドサイズ。 |
overridePixelPerfect | 階層内にあるネストされた Canvas で親から継承された pixelPerfect 設定で上書きするのを可能にします |
overrideSorting | Canvas のソートを上書きします |
pixelPerfect | ピクセルと整列するようにキャンバスの要素を焼成します。renderMode が Screen Space のときのみ適用されます。 |
pixelRect | Canvas のためのレンダー矩形を取得します。 |
planeDistance | 生成する Canvas のカメラからの距離 |
referencePixelsPerUnit | デフォルトの 1unit あたりのピクセル数 |
renderingDisplaySize | Returns the canvas display size based on the selected render mode and target display. |
renderMode | Canvas がワールドかオーバーレイモードかどうか |
renderOrder | The render order in which the canvas is being emitted to the Scene. (Read Only) |
rootCanvas | 各親を確認し見つけた最後の canvas を返すことによって、ルートに最も近い Canvas を返します。他に canvas が見つからない場合は、自身を返します。 |
scaleFactor | スクリーンにフィットさせながらキャンバス全体のスケールするために使用します。renderMode が Screen Space のときのみ適用されます。 |
sortingLayerID | Canvas のソーティングレイヤーのユニーク ID |
sortingLayerName | Canvas のソーティングレイヤーの名前 |
sortingOrder | ソーティングレイヤーのオーダー順 |
targetDisplay | Overlay モードで、どのディスプレイ番号に対して UI Canvas を表示するか |
updateRectTransformForStandalone | Should the Canvas size be updated based on the render target when a manual Camera.Render call is performed. |
vertexColorAlwaysGammaSpace | Should the Canvas vertex color always be in gamma space before passing to the UI shaders in linear color space work flow. |
worldCamera | Camera used for sizing the Canvas when in Screen Space - Camera. Also used as the Camera that events will be sent through for a World Space Canvas. |
ForceUpdateCanvases | コンテンツを更新するために強制的にすべての Canvas を更新します |
GetDefaultCanvasMaterial | Canvas 上にある通常の要素のレンダリングで使用されるデフォルトのマテリアルを取得します |
GetETC1SupportedCanvasMaterial | Gets or generates the ETC1 Material. |
preWillRenderCanvases | Canvas のレンダリングが発生する前に呼び出されるイベント |
willRenderCanvases | Canvas のレンダリングが発生する前に呼び出されるイベント |
enabled | 有効であれば更新され、無効であれば更新されません。 |
isActiveAndEnabled | Reports whether a GameObject and its associated Behaviour is active and enabled. |
gameObject | このコンポーネントはゲームオブジェクトにアタッチされます。コンポーネントはいつもゲームオブジェクトにアタッチされています。 |
tag | ゲームオブジェクトのタグ |
transform | The Transform attached to this GameObject. |
hideFlags | Should the object be hidden, saved with the Scene or modifiable by the user? |
name | オブジェクト名 |
BroadcastMessage | ゲームオブジェクトまたは子オブジェクトにあるすべての MonoBehaviour を継承したクラスにある methodName 名のメソッドを呼び出します。 |
CompareTag | Checks the GameObject's tag against the defined tag. |
GetComponent | Gets a reference to a component of type T on the same GameObject as the component specified. |
GetComponentInChildren | Gets a reference to a component of type T on the same GameObject as the component specified, or any child of the GameObject. |
GetComponentInParent | Gets a reference to a component of type T on the same GameObject as the component specified, or any parent of the GameObject. |
GetComponents | Gets references to all components of type T on the same GameObject as the component specified. |
GetComponentsInChildren | Gets references to all components of type T on the same GameObject as the component specified, and any child of the GameObject. |
GetComponentsInParent | Gets references to all components of type T on the same GameObject as the component specified, and any parent of the GameObject. |
SendMessage | ゲームオブジェクトにアタッチされているすべての MonoBehaviour にある methodName と名付けたメソッドを呼び出します |
SendMessageUpwards | ゲームオブジェクトと親(の親、さらに親 ... )にアタッチされているすべての MonoBehaviour にある methodName と名付けたメソッドを呼び出します |
TryGetComponent | Gets the component of the specified type, if it exists. |
GetInstanceID | Gets the instance ID of the object. |
ToString | Returns the name of the object. |
Destroy | Removes a GameObject, component or asset. |
DestroyImmediate | Destroys the object obj immediately. You are strongly recommended to use Destroy instead. |
DontDestroyOnLoad | Do not destroy the target Object when loading a new Scene. |
FindAnyObjectByType | Retrieves any active loaded object of Type type. |
FindFirstObjectByType | Retrieves the first active loaded object of Type type. |
FindObjectOfType | タイプ type から最初に見つけたアクティブのオブジェクトを返します |
FindObjectsByType | Retrieves a list of all loaded objects of Type type. |
FindObjectsOfType | Gets a list of all loaded objects of Type type. |
Instantiate | original のオブジェクトをクローンします |
bool | オブジェクトが存在するかどうか |
operator != | 二つのオブジェクトが異なるオブジェクトを参照しているか比較します |
operator == | 2つのオブジェクト参照が同じオブジェクトを参照しているか比較します。 |
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.