Error pause unity

The Background Tasks window

The Background Tasks window

The Console Window shows errors, warnings and other messages generated by Unity.

You can also show your own messages in the Console using the Debug class.

Everything that is written to the Console Window (by Unity, or your own code) is also written to a Log File.

To open the Console from Unity’s main menu, select 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 toolbarA row of buttons and basic controls at the top of the Unity Editor that allows you to interact with the Editor in various ways (e.g. scaling, translation). More info
See in Glossary
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.

Console toolbar options

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

Option: Function:
Clear Removes any messages generated from your code but retains compiler errors.
Collapse Shows only the first instance of recurring error messages.

This is useful for run-time errors, such as null references, that are sometimes generated on each frame update.

Clear On Play Clears the Console automatically whenever you enter Play mode.
Clear on Build Clears the Console when you build the Project.
Error Pause Pauses playback whenever Debug.LogError is called from a script.

This is useful when you want to freeze playback at a specific point in the execution and inspect the Scene.

This option does not pause playback when Debug.Log is called.

[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 buildA development build includes debug symbols and enables the Profiler. More info
See in Glossary
, 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:

Button Message type
Messages
Warnings
Errors

Adjusting the line count

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.

Stack trace logging

Unity can include detailed stack trace information when it prints messages to the Console or Log file. This is useful when, for example, an error message is not very clear. In that case, the stack trace can help you determine the source of the error.

Managed vs. unmanaged stack trace

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 LogThe .log file created by a Standalone Player that contains a record of events, such as script execution times, the compiler version, and AssetImport time. Log files can help diagnose problems. More info
See in Glossary
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 RigidbodyA component that allows a GameObject to be affected by simulated gravity and other forces. More info
See in Glossary
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;

These shortcuts have been deprecated, so you should now use code like:

    // 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 Page amended

  • Log entry line count added in 2017.3 NewIn20173

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

The Background Tasks window

The Background Tasks window

The Console Window shows errors, warnings and other messages generated by Unity.

You can also show your own messages in the Console using the Debug class.

Everything that is written to the Console Window (by Unity, or your own code) is also written to a Log File.

To open the Console from Unity’s main menu, select 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 toolbarA row of buttons and basic controls at the top of the Unity Editor that allows you to interact with the Editor in various ways (e.g. scaling, translation). More info
See in Glossary
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.

Console toolbar options

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

Option: Function:
Clear Removes any messages generated from your code but retains compiler errors.
Collapse Shows only the first instance of recurring error messages.

This is useful for run-time errors, such as null references, that are sometimes generated on each frame update.

Clear On Play Clears the Console automatically whenever you enter Play mode.
Clear on Build Clears the Console when you build the Project.
Error Pause Pauses playback whenever Debug.LogError is called from a script.

This is useful when you want to freeze playback at a specific point in the execution and inspect the Scene.

This option does not pause playback when Debug.Log is called.

[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 buildA development build includes debug symbols and enables the Profiler. More info
See in Glossary
, 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:

Button Message type
Messages
Warnings
Errors

Adjusting the line count

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.

Stack trace logging

Unity can include detailed stack trace information when it prints messages to the Console or Log file. This is useful when, for example, an error message is not very clear. In that case, the stack trace can help you determine the source of the error.

Managed vs. unmanaged stack trace

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 LogThe .log file created by a Standalone Player that contains a record of events, such as script execution times, the compiler version, and AssetImport time. Log files can help diagnose problems. More info
See in Glossary
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 RigidbodyA component that allows a GameObject to be affected by simulated gravity and other forces. More info
See in Glossary
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;

These shortcuts have been deprecated, so you should now use code like:

    // 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 Page amended

  • Log entry line count added in 2017.3 NewIn20173

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

The Background Tasks window

В окне Консоль отображаются ошибки, предупреждения и другие сообщения, генерируемые редактором. Эти ошибки и предупреждения помогают найти проблемы в проекте, например ошибки компиляции сценария. Они также предупреждают вас о действиях, предпринятых редактором автоматически, например о замене отсутствующих метафайлов, что может вызвать проблему где-то еще в вашем проекте.

Чтобы облегчить отладку проекта, используйте класс Debug для вывода собственных сообщений в консоль. Например, вы можете распечатать значение переменной в определенных точках вашего скрипта, чтобы увидеть, как они меняются.

На этой странице описаны параметры, которые можно использовать при работе с окном консоли, а также способы фильтрации сообщений путем поиска по определенным ключевым словам.

Интерфейс окна консоли

Чтобы открыть консоль, в главном меню Unity выберите Окно > Общие > Консоль.

А. Консоль панель инструментовряд кнопок и основных элементов управления в верхней части редактора Unity, который позволяет вам взаимодействовать с Редактировать различными способами (например, масштабирование, перевод). Подробнее
См. в Словарь
содержит параметры для управления отображением сообщений, и для поиска и фильтрации сообщений.

Б. В меню окна консоли есть параметры для открытия файлов журнала, управления сколько каждого сообщения отображается в список и настройка параметров трассировки стека.

С. В списке консоли отображается запись для каждого зарегистрированного сообщения. Выберите сообщение, чтобы отобразить весь его текст в области сведений. Вы можете выбрать, сколько строк каждого сообщения будет отображаться здесь. См. раздел Настройка количества строк ниже.

Д. В области сведений отображается полный текст выбранного сообщения. Если вы включите трассировку стека, в области сведений будут отображаться ссылки на определенные строки в файлах кода в виде интерактивных ссылок.

Параметры панели инструментов консоли

На панели инструментов окна консоли есть параметры для управления отображением сообщений, а также для поиска и фильтрации сообщений.

Option: Функция:
Clear Удаляет любые сообщения, созданные из вашего кода, но сохраняет ошибки компилятора.

Открывает раскрывающееся меню с параметрами очистки.

Clear On Play Автоматически очищает консоль всякий раз, когда вы входите в режим воспроизведения.
Clear on Build Очищает консоль при сборке проекта.
Clear on Recompile Очищает консоль при перекомпиляции проекта.
Collapse Отображает только первый экземпляр повторяющихся сообщений об ошибках.

Это полезно для ошибок во время выполнения, таких как нулевые ссылки, которые иногда генерируются при каждом обновлении кадра.

Error Pause Приостанавливает воспроизведение всякий раз, когда вы вызываете Debug.LogError из скрипта.

Используйте это, чтобы приостановить воспроизведение в определенной точке выполнения и проверить сцену. Этот параметр не приостанавливает воспроизведение при вызове Debug.Log из сценария.

[Attach-to-Player] Открывает раскрывающееся меню с параметрами для подключения к сборкам разработки, запущенным на удаленных устройствах, и отображения их журналов проигрывателя в консоли.

Этот параметр помечен именем целевой сборки для разработки (это сборка журнала, отображаемая в окне консоли). Если консоль не подключена к удаленной сборке, она помечена как Редактор, чтобы показать, что журнал, отображаемый в окне консоли, получен из локального редактора Unity.

Player Logging Если консоль подключена к сборке для удаленной разработки, это позволяет вести журнал Player для сборки.

Отключение этого параметра приостанавливает ведение журнала, но консоль остается подключенной к целевой сборке.

Отключение этого параметра также скрывает остальные параметры в этом раскрывающемся меню.

Выберите любую сборку из списка ниже Ведение журнала игрока, чтобы отобразить ее журнал в окне консоли.

Editor Если консоль подключена к удаленной разрабатываемой сборкеразрабатываемая сборка включает символы отладки и включает профилировщик. Подробнее
См. в Словарь
. Выберите этот параметр, чтобы отобразить журнал из локальный проигрыватель Unity вместо журнала удаленной сборки.
Открывает диалоговое окно Введите IP-адрес проигрывателя, в котором вы можете указать IP-адрес разрабатываемой сборки на удаленном устройстве.

Чтобы подключиться к сборке, выберите Подключить в диалоговом окне и добавьте ее в список разрабатываемых сборок в нижней части раскрывающегося меню.

[DEVELOPMENT BUILDS] Список доступных сборок для разработки. Сюда входят автоматически определяемые сборки и те, которые вы добавляете с помощью параметра Введите IP.

Поиск и фильтрация выходных данных консоли

Вы можете искать сообщения консоли по определенным ключевым словам в строке поиска консоли. Когда вы вводите поисковый запрос, консоль фильтрует сообщения, чтобы отображались только те, которые содержат соответствующий текст. Консоль выделяет только первое совпадение в тексте сообщения и только в том случае, если оно находится в видимой части сообщения (см. Настройка количества строк ниже).

Поиск термина «имя» выделяет первое совпадение в каждом сообщении.

Поиск термина «имя» выделяет первое совпадение в каждом сообщении.

Вы можете искать все, что появляется в любом сообщении консоли, включая цифры и специальные символы. Например, вы можете найти время, когда консоль зарегистрировала сообщение.

Поиск ищет точные совпадения с тем, что вы вводите в строке поиска. Вы не можете искать два разных термина одновременно или использовать общие операторы поисковых систем.

Вы также можете фильтровать сообщения консоли по типу. Нажимайте кнопки рядом с панелью поиска для переключения:

Кнопка Функция

Messages switch

Отображает количество сообщений в консоли. Нажмите, чтобы отобразить или скрыть сообщения.

Warnings switch

Отображает количество предупреждений в консоли. Нажмите, чтобы отобразить или скрыть предупреждения.

Errors switch

Отображает количество ошибок в консоли. Нажмите, чтобы отобразить или скрыть ошибки.

Регулировка количества строк

Каждая запись консоли может содержать до 10 строк.

Чтобы указать, сколько строк каждой записи отображается в списке, нажмите кнопку меню консоли и выберите в меню Запись журнала > [X] строк, где [X] — количество строк, отображаемых для каждой записи.

Количество строк записи журнала

Количество строк записи журнала

Большее количество строк отображает больше текста каждой записи, но уменьшает количество записей, видимых в любой момент времени. Количество строк не влияет на функцию поиска консоли, которая всегда ищет полный текст сообщения. Если совпадающий текст находится в скрытой строке, поиск возвращает сообщение в результатах, но не расширяет его, чтобы показать или выделить совпадающий текст. Вы можете увидеть полный текст сообщения в области сведений, но совпадающий текст там не выделен.

Ведение журнала трассировки стека

Сообщения консоли Unity и файлы журналов могут содержать подробную информацию о трассировке стека. Вы можете управлять объемом информации о трассировке стека, используя настройки ведения журнала трассировки стека.

Открытие файлов журнала из консоли

Все, что Unity или ваш код записывает в окно консоли, также записывается в файл журнала. Вы можете открыть файлы журнала из меню окна консоли. Выберите Открыть Журнал проигрывателяФайл .log, созданный автономным проигрывателем, который содержит запись событий, таких как выполнение скрипта. раз, версия компилятора и время AssetImport. Файлы журнала могут помочь в диагностике проблем. Подробнее
См. в Словарь
или Открыть журнал редактора.

Понравилась статья? Поделить с друзьями:
  • Error pathspec readme md did not match any file s known to git
  • Error pathspec project did not match any file s known to git
  • Error pathspec initial commit did not match any file s known to git
  • Error pathspec homework did not match any file s known to git
  • Error pathspec did not match any file s known to git что делать