Version: 2022.1
언어: 한국어

GUIContentConstructor

매뉴얼로 전환
public GUIContent ();

설명

Constructor for GUIContent in all shapes and sizes.

Build an empty GUIContent.


public GUIContent (string text);

설명

Build a GUIContent object containing only text.

When using the GUI, you don't need to create GUIContents for simple text strings - these two lines of code are functionally equivalent:

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);

설명

Build a GUIContent object containing only an image.

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);

설명

Build a GUIContent object containing both text and an image.

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);

설명

Build a GUIContent containing some text. When the user hovers the mouse over it, the global GUI.tooltip is set to the tooltip.

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);

설명

Build a GUIContent containing an image. When the user hovers the mouse over it, the global GUI.tooltip is set to the tooltip.


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

설명

Build a GUIContent that contains both text, an image and has a tooltip defined. When the user hovers the mouse over it, the global GUI.tooltip is set to the tooltip.


public GUIContent (GUIContent src);

설명

Build a GUIContent as a copy of another GUIContent.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961