Version: 2019.4
public GUIContent ();

説明

GUIContent のコンストラクター

空の GUIContent を作成します。


public GUIContent (string text);

説明

テキストのみ含む GUIContent を作成します。

GUI を使用するときに、シンプルなテキストの場合は GUIContent を作成する必要はありません - 以下の二つのコードは機能的に同じものです。

using UnityEngine;

public class ExampleScript : MonoBehaviour { void OnGUI() { GUI.Button(new Rect(0, 0, 100, 20), "Click Me"); GUI.Button(new Rect(0, 30, 100, 20), new GUIContent("Click Me")); } }

public GUIContent (Texture image);

説明

画像のみ含む GUIContent を作成します。

using UnityEngine;

public class ExampleScript : MonoBehaviour { public Texture icon; void OnGUI() { GUI.Button(new Rect(0, 30, 100, 20), new GUIContent(icon)); } }

public GUIContent (string text, Texture image);

説明

text と画像の両方を含む GUIContent を作成します。

using UnityEngine;

public class ExampleScript : MonoBehaviour { public Texture icon; void OnGUI() { GUI.Button(new Rect(0, 30, 100, 20), new GUIContent("Click me", icon)); } }

public GUIContent (string text, string tooltip);

説明

text を含む GUIContent を作成します。ユーザーが GUI の上にマウスを乗せると、グローバルの GUI.tooltiptooltip がセットされます。

using UnityEngine;

public class ExampleScript : MonoBehaviour { void OnGUI() { GUI.Button(new Rect(0, 0, 100, 20), new GUIContent("Click me", "This is the tooltip"));

// If the user hovers the mouse over the button, the global tooltip gets set GUI.Label(new Rect(0, 40, 100, 40), GUI.tooltip); } }

public GUIContent (Texture image, string tooltip);

説明

image を含む GUIContent を作成します。ユーザーが GUI の上にマウスを乗せると、グローバルの GUI.tooltiptooltip がセットされます。


public GUIContent (string text, Texture image, string tooltip);

説明

textimage の両方を含み、tooltip が定義された GUIContent を作成します。ユーザーが GUI の上にマウスを乗せると、グローバルの GUI.tooltiptooltip がセットされます。


public GUIContent (GUIContent src);

説明

他の GUIContent をコピーして作成します。