Creating Screen Transitons
GUI의 기본 (Legacy)

Immediate Mode GUI (IMGUI)

The “Immediate Mode” GUI system (also known as IMGUI) is an entirely separate feature to Unity’s main GameObject-based UI System. IMGUI is a code-driven GUI system, and is mainly intended as a tool for programmers. It is driven by calls to the OnGUI function on any script which implements it. For example, this code:

    void OnGUI() {
        if (GUILayout.Button("Press Me"))

Would result in a button displayed like so:

The result of the above code example
The result of the above code example

The Immediate Mode GUI system is commonly used for:

  • Creating in-game debugging displays and tools.
  • Creating custom inspectors for script components.
  • Creating new editor windows and tools to extend Unity itself.

The IMGUI system is not generally intended to be used for normal in-game user interfaces that players might use and interact with. For that you should use Unity’s main GameObject-based UI system, which offers a GameObject-based approach for editing and positioning UI elements, and has far better tools to work with the visual design and layout of the UI.

“Immediate Mode” refers to the way the IMGUI is created and drawn. To create IMGUI elements, you must write code that goes into a special function named OnGUI. The code to display the interface is executed every frame, and drawn to the screen. There are no persistent gameobjects other than the object to which your OnGUI code is attached, or other types of objects in the hierarchy related to the visual elements that are drawn.

레거시 GUI를 통해 기능을 갖춘 다양한 GUI를 코드로 만들 수 있습니다. GUI 오브젝트를 만들어 수동으로 배치하고 그 기능을 처리하는 스크립트를 작성하는 대신, 이 모든 것을 적은 양의 코드로 한번에 수행합니다. 이것은 GUI Controls 인스턴스화 배포, 정의의 모든 것을 한 번의 함수 호출로 처리합니다.

이 섹션에서는 게임과 Unity 에디터 확장 기능, 이 둘의 GUI를 사용하는 방법에 대해 설명합니다.

Creating Screen Transitons
GUI의 기본 (Legacy)