차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판이전 판
다음 판
이전 판
unity:gui-basics [2022/04/22 16:56] V_Lunity:gui-basics [2022/04/22 17:09] (현재) – [GUI Basics] V_L
줄 5: 줄 5:
 이 섹션은 ''UnityGUI''와 ''Controls''함께 컨트롤을 스크립팅하기 위해 필수적인 것들을 설명할 것임. 이 섹션은 ''UnityGUI''와 ''Controls''함께 컨트롤을 스크립팅하기 위해 필수적인 것들을 설명할 것임.
  
 +// 성능상의 이유로 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,10,200,20), "Meet the flashing button")) { 
-            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,0,100,50), "Top-left"); 
-    GUI.Box (Rect (Screen.width - 100,0,100,50), "Top-right"); 
-    GUI.Box (Rect (0,Screen.height - 50,100,50), "Bottom-left"); 
-    GUI.Box (Rect (Screen.width - 100,Screen.height - 50,100,50), "Bottom-right"); 
-} 
  
 // C# // C#
줄 142: 줄 126:
 <file csharp> <file csharp>
 /* String Content example */ /* String Content example */
- + 
-// JavaScript +
-function OnGUI () { +
-    GUI.Label (Rect (0,0,100,50), "This is the text string for a Label Control"); +
-+
 // C# // C#
 using UnityEngine; using UnityEngine;
줄 166: 줄 145:
 /* Texture2D Content example */ /* Texture2D Content example */
  
-// JavaScript + 
-var controlTexture : Texture2D; +
- +
-function OnGUI () { +
-    GUI.Label (Rect (0,0,100,50), controlTexture); +
-+
 // 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,10,100,50), GUIContent("This is text", icon)); +
-+
 // 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" into GUI.tooltip 
-    GUI.Button (Rect (10,10,100,20), GUIContent ("Click me", "This is the tooltip")); 
-    // This line reads and displays the contents of GUI.tooltip 
-    GUI.Label (Rect (10,40,100,20), GUI.tooltip); 
-} 
  
 // 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,10,100,20), GUIContent ("Click me", icon, "This is the tooltip")); 
-    GUI.Label (Rect (10,40,100,20), GUI.tooltip); 
-} 
  
 // C# // C#
줄 312: 줄 251:
 방대한 양의 예제 목록을 위한 [[ScriptRef:GUIContent.GUIContent.html|GUIContent's constructor]]를 위한 스크립팅 레퍼런스 페이지. 방대한 양의 예제 목록을 위한 [[ScriptRef:GUIContent.GUIContent.html|GUIContent's constructor]]를 위한 스크립팅 레퍼런스 페이지.
  
-   * 출처: [[http://unitykoreawiki.com/index.php?n=KrMain.gui-Basics|유니티코리아위키]] (CC BY-NC-SA 2.0) +   * 출처: [[https://docs.unity3d.com/kr/current/Manual/gui-Basics.html]]