스크립팅 툴(Scripting Tools)
로그 파일

콘솔 창

Console 창은 Unity에서 생성되는 오류, 경고, 기타 메시지를 표시합니다.

Debug.Log, Debug.LogWarning, Debug.LogError 함수를 사용하여 콘솔에 원하는 메시지를 표시할 수도 있습니다.

콘솔 창을 열려면 Unity 메인 메뉴에서 Window > General > Console을 선택합니.

A. The Console window menu has options for opening Log files, controlling how much of each message is visible in the list, and setting stack trace options.

B. The Console toolbar has options for controlling how messages are displayed, and for searching and filtering messages.

C. The Console list displays an entry for each logged message.

Select a message to display its entire text in the detail area.You can choose how many lines of each message to display here.

See Adjusting the line count, below, for further information.

D. The detail area shows the full text of the selected message.

If stack trace is enabled, references to specific lines in code files show up as clickable links here.

콘솔 툴바 옵션

The toolbar of the Console window has options for controlling how messages are displayed, and for searching and filtering messages.

옵션: 기능:
Clear 컴파일러 오류를 제외하고 코드가 생성한 모든 메시지를 지웁니다.
Collapse 반복해서 발생하는 오류 메시지를 모두 표시하는 대신 첫 번째 인스턴스만 표시합니다.

각 프레임 업데이트마다 발생하는 null 레퍼런스와 같은 런타임 오류를 간결하게 보고 싶을 때 매우 유용합니다.
Clear On Play 플레이 모드를 실행할 때 콘솔 창의 내용을 자동으로 지웁니다.
Clear on Build Clears the Console when you build the Project.
Error Pause Debug.LogError가 스크립트에서 호출될 때마다 재생이 일시 정지됩니다.

이 옵션은 실행 중인 특정 시점에서 재생을 멈추고 씬을 검사하고 싶을 때 유용합니다.

Debug.Log가 호출될 때는 재생이 일시 정지되지 않습니다.
[Attach-to-Player] Opens a drop-down menu with options for connecting to development builds that are running on remote devices, and displaying their Player logs in the Console.

This option is labeled with the name of the target development build (which is the build of the log that is displayed in the Console window). If the Console is not connected to a remote build, it is labeled Editor to indicate that the log displayed in the Console window is from the local Unity Editor.
Player Logging If the Console is connected to a remote development build, this enables Player logging for the build.

Disabling this option suspends logging, but the Console remains connected to the target build.

Disabling this option also hides the rest of the options in this drop-down menu.

Select any build listed below Player Logging to display its log in the Console window.
Editor If the Console is connected to a remote development build, select this option to display the log from the local Unity Player instead of the log from the remote build.
<Enter IP> Opens the Enter Player IP dialog, where you can specify the IP address of a development build on a remote device.

Click the Connect button in the dialog to connect to the build, and add it to the list of development builds at the bottom of the drop-down menu.
[DEVELOPMENT BUILDS] Lists the available development builds. This includes auto-detected builds as well as those that you add using the Enter IP option.
Messages switch Displays the number of messages in the Console. Click to show/hide messages.
Warnings switch Displays the number of warnings in the Console. Click to show/hide warnings.
Errors switch Displays the number of errors in the Console. Click to show/hide errors.

Searching and filtering Console output

You can search Console messages for specific keywords from the Console search bar. As you type a search term, the Console filters messages to display only those that contain matching text. The Console highlights the first match in the message text when it is in the visible part of the message (see Adjusting the Line Count below). It does not highlight subsequent matches in the same message.

Searching for the term animation highlights the first match in each message (blue), but not subsequent matches (red)
Searching for the term “animation” highlights the first match in each message (blue), but not subsequent matches (red)

You can search for anything that appears in any Console message, including numerals and special characters. For example, you might want to search for the time a message was logged rather than a keyword contained in the message.

The search looks for exact matches of whatever you type in the search bar. You cannot search for two different terms at once, or use common search engine operators.

You can also filter Console message by type. Click the buttons beside the search bar to toggle:

버튼 메시지 타입
메시지
경고
오류

줄 수 조절

Each Console entry can be up to 10 lines long.

To control how many lines of each entry are visible in the list, click the Console menu button, and select Log Entry > [X] Lines from the menu, where [X] is the number of lines you wish to display for each entry.

Log entry line count
Log entry line count

A larger line count displays more of the text of each entry, but reduces the number of entries visible at any given time.

Line count does not affect the Console search function, which always searches the full message text. If the matching text is on a hidden line, the search returns the message in the results, but does not expand it to reveal/highlight the matching text. You can see the full message text in the detail area, but the matching text is not highlighted there.

스택 추적 로깅

Unity에서 메시지를 콘솔이나 로그 파일로 출력할 때 상세한 스택 추적 정보를 포함할 수 있습니다. 이 옵션은 예를 들어, 오류 메시지가 명확하지 않을 때 유용합니다. 스택 추적을 통해 오류가 발생한 출처를 확인할 수 있습니다.

관리되는 스택 추적 vs. 관리되지 않는 스택 추적

The Console can provide stack trace information for managed code and unmanaged code.

  • Managed code means C# scripts running in Unity. These can be scripts that ship with Unity, custom scripts that you write, third-party scripts included with an Asset store plug-in, or any other type of C# script that runs in the engine.

    In some cases, you have access to managed code, and can modify it when debugging. In other cases, you don’t—for example when managed scripts are compiled into a managed .dll, you can see managed stack trace information, but you cannot modify the managed code unless you have access to the original source files.

  • Unmanaged code means native Unity engine code, or code from a native plugin running directly on your machine, or on a target build platform.

    Unmanaged code is usually compiled from C or C++ code. You cannot access it unless you have the original source code of the native binary.

In most cases, you only use the managed stack trace to help debug your C# code. However, the full stack trace can be useful in some circumstances.

For example, unmanaged stack trace can help you determine whether an error is caused by your code or the engine. It can also help you identify the area of the engine that an error originates from. This is especially useful when no managed stack trace information is available, and the error message is not very descriptive.

NOTE: Resolving a stack trace, especially a full stack trace, is a resource-intensive operation. Use these options for debugging purposes only.

Setting the stack trace type

To specify how much detail to include in the stack trace, click the Console menu button, and select Stack Trace Logging > [MESSAGE TYPE] from the menu, where [MESSAGE TYPE] is the type of message you want to include stack trace information for. Then select one of the following options:

Stack trace logging options
Stack trace logging options
  • None: Unity does not output stack trace information.

  • ScriptOnly: Unity outputs stack trace information for managed code.

  • Full: Unity outputs stack trace information for both managed and unmanaged code.

You can also control stack trace logging via scripting API. See the API reference documentation on Application.SetStackTraceLogType for more details.

Opening source files from the stack trace output

When you select a message and view the full text in the detail area at the bottom of the Console window, stack trace references to specific lines in code files become clickable links. Click any link to open the file in your IDE at the referenced line.

Opening Log files from the Console

You can open Log files from the Console window menu. Choose Open Player Log or Open Editor Log.

Obsolete API warnings and automatic updates

Among other messages, Unity shows warnings about the usage of obsolete API calls in your code. For example, Unity previously had “shortcuts” in MonoBehaviour and other classes to access common component types. So, for example, you could access a Rigidbody on the object using code like:

    // The "rigidbody" variable is part of the class and not declared in the user script.
        Vector3 v = rigidbody.velocity;

이 단축키는 더 이상 지원되지 않으므로 다음과 같은 코드를 사용해야 합니다.

    // Use GetComponent to access the component.
        Rigidbody rb = GetComponent<Rigidbody>();
        Vector3 v = rb.velocity;

When the Console detects obsolete API calls, Unity shows a warning message about them. When you double-click this message, Unity automatically attempts to upgrade the deprecated usage to the recommended equivalent .


  • 2019–03–11 일부 편집 리뷰를 거쳐 페이지 수정됨

  • Unity 2017.3에서 로그 항목 줄 수 추가됨 NewIn20173

  • Search bar and clickable stack trace messages added in 2019.1 NewIn20191

스크립팅 툴(Scripting Tools)
로그 파일