차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판이전 판다음 판 | 이전 판 | ||
unity:gui-basics [2022/04/22 16:56] – V_L | unity:gui-basics [2022/04/22 17:09] (현재) – [GUI Basics] V_L | ||
---|---|---|---|
줄 5: | 줄 5: | ||
이 섹션은 '' | 이 섹션은 '' | ||
+ | // 성능상의 이유로 Unity는 게임 내 런타임 UI에 IMGUI를 권장하지 않습니다. // | ||
=====Making Controls with UnityGUI===== | =====Making Controls with UnityGUI===== | ||
줄 56: | 줄 57: | ||
<file csharp> | <file csharp> | ||
/* Flashing button example */ | /* Flashing button example */ | ||
- | |||
- | // JavaScript | ||
- | function OnGUI () { | ||
- | if (Time.time % 2 < 1) { | ||
- | if (GUI.Button (Rect (10, | ||
- | print ("You clicked me!"); | ||
- | } | ||
- | } | ||
- | } | ||
// C# | // C# | ||
줄 108: | 줄 100: | ||
<file csharp> | <file csharp> | ||
/* Screen.width & Screen.height example */ | /* Screen.width & Screen.height example */ | ||
- | |||
- | // JavaScript | ||
- | function OnGUI () { | ||
- | GUI.Box (Rect (0, | ||
- | GUI.Box (Rect (Screen.width - 100, | ||
- | GUI.Box (Rect (0, | ||
- | GUI.Box (Rect (Screen.width - 100, | ||
- | } | ||
// C# | // C# | ||
줄 142: | 줄 126: | ||
<file csharp> | <file csharp> | ||
/* String Content example */ | /* String Content example */ | ||
- | + | ||
- | // JavaScript | + | |
- | function OnGUI () { | + | |
- | GUI.Label (Rect (0, | + | |
- | } | + | |
// C# | // C# | ||
using UnityEngine; | using UnityEngine; | ||
줄 166: | 줄 145: | ||
/* Texture2D Content example */ | /* Texture2D Content example */ | ||
- | // JavaScript | + | |
- | var controlTexture : Texture2D; | + | |
- | + | ||
- | function OnGUI () { | + | |
- | GUI.Label (Rect (0, | + | |
- | } | + | |
// C# | // C# | ||
public Texture2D controlTexture; | public Texture2D controlTexture; | ||
줄 187: | 줄 160: | ||
/* Button Content examples */ | /* Button Content examples */ | ||
- | // JavaScript | + | |
- | var icon : Texture2D; | + | |
- | + | ||
- | function OnGUI () { | + | |
- | if (GUI.Button (Rect (10,10, 100, 50), icon)) { | + | |
- | print ("you clicked the icon" | + | |
- | } | + | |
- | + | ||
- | if (GUI.Button (Rect (10,70, 100, 20), "This is text" | + | |
- | print ("you clicked the text button" | + | |
- | } | + | |
- | } | + | |
// C# | // C# | ||
using UnityEngine; | using UnityEngine; | ||
줄 229: | 줄 190: | ||
/* Using GUIContent to display an image and a string */ | /* Using GUIContent to display an image and a string */ | ||
- | // JavaScript | + | |
- | var icon : Texture2D; | + | |
- | + | ||
- | function OnGUI () { | + | |
- | GUI.Box (Rect (10, | + | |
- | } | + | |
// C# | // C# | ||
using UnityEngine; | using UnityEngine; | ||
줄 255: | 줄 210: | ||
<file csharp> | <file csharp> | ||
/* Using GUIContent to display a tooltip */ | /* Using GUIContent to display a tooltip */ | ||
- | |||
- | // JavaScript | ||
- | function OnGUI () { | ||
- | // This line feeds "This is the tooltip" | ||
- | GUI.Button (Rect (10, | ||
- | // This line reads and displays the contents of GUI.tooltip | ||
- | GUI.Label (Rect (10, | ||
- | } | ||
// C# | // C# | ||
줄 285: | 줄 232: | ||
<file csharp> | <file csharp> | ||
/* Using GUIContent to display an image, a string, and a tooltip */ | /* Using GUIContent to display an image, a string, and a tooltip */ | ||
- | |||
- | // JavaScript | ||
- | var icon : Texture2D; | ||
- | |||
- | function OnGUI () { | ||
- | GUI.Button (Rect (10, | ||
- | GUI.Label (Rect (10, | ||
- | } | ||
// C# | // C# | ||
줄 312: | 줄 251: | ||
방대한 양의 예제 목록을 위한 [[ScriptRef: | 방대한 양의 예제 목록을 위한 [[ScriptRef: | ||
- | * 출처: [[http://unitykoreawiki.com/index.php? | + | * 출처: [[https://docs.unity3d.com/kr/ |