Unity monodevelop как установить

от admin

MonoDevelop

MonoDevelop — это интегрированная среда разработки (IDE), поставляемая вместе с Unity. IDE сочетает в себе функции текстового редактора с дополнительными возможностями для отладки и выполнения других задач по управлению проектами. Здесь не будет рассматриваться текстовый редактор, так как он достаточно интуитивен, но интеграция редактора и отладчика с Unity описана ниже.

Настройка MonoDevelop

MonoDevelop устанавливается по умолчанию вместе с Unity. Во время установки Unity на Windows, вы можете отменить установку MonoDevelop. Вы должны убедиться, что MonoDevelop установлен в качестве внешнего редактора скриптов в Preferences (меню: Unity > Preferences, а затем выберите панель External Tools). Если эта опция включена, Unity запустит MonoDevelop и будет использовать его в качестве редактора по умолчанию для всех скриптовых файлов.

Настройка отладчика

Чтобы включить отладку исходного кода (см. ниже для подробностей) в MonoDevelop, вам сперва следует проверить, что в Preferences, на панели External Tools включена опция Editor Attaching. Затем, вам следует синхронизировать ваш Unity проект с проектом MonoDevelop (меню: Assets > Sync MonoDevelop Project). Кроме того, убедитесь, что в BuildSettings целевой платформы (меню: File > Build Settings) включены опции Development Build и Script Debugging. Если вы собираете под WebPlayer, тогда вам следует дополнительно убедиться, что в контексте вашего проигрывателя выбран канал версий для разработчиков (правый клик в Windows или cmd-клик в Mac OSX).

Включение отладки в webplayer

Just before starting a debugging session, select the target you wish to debug from the target list next to the play button (Unity Editor, OSX Player, etc.). You can also select “Attach To Process”, this will show the full list of debuggable Unity processes.

Вкладка, показывающая значения переменныхВкладка, показывающая значения переменных

With these steps completed, you are ready to being debugging your Unity scripts by clicking the play button.

Отладка исходного кода

Текущие открытые исходные файлы отображаются в MonoDevelop в виде вкладок и могут быть отредактированы как в стандартном текстовом редакторе. Также есть серая шкала точек останова (breakpoint bar) слева от панели редактора. Щелчок на этой шкале добавит так называемый маркер точки останова ( breakpoint ) напротив текущей строчки кода.

Breakpoint, добавленный в код а строке 16Breakpoint, добавленный в код а строке 16

Добавление breakpoint’а на линию сообщает Unity, что по достижению этой линии во время Play Mode, следует приостановить выполнение скрипта. Когда скрипт так “замораживается”, вы можете использовать отладчик для определения того, что именно делает скрипт.

Стрелка показывает, что выполнение приостановлено на точке остановаСтрелка показывает, что выполнение приостановлено на точке останова

При приостановке выполнения на точке останова, во вкладках в нижней части окна MonoDevelop показывается информация о текущем состоянии выполнения. Возможно, наиболее важной из вкладок является Locals.

Вкладка, показывающая значения переменныхВкладка, показывающая значения переменных

В этой вкладке показаны значения локальных переменных в текущей функции (псевдо-локальная переменная с именем this автоматически доступна в каждой функции, хоть она и не объявлена явно; это ссылка на текущий экземпляр скрипта, так что через “this” можно получить доступ ко всем переменным, объявленным в скрипте). Вы можете использовать точки прерывания вместе с вкладкой Locals для получения эффекта, аналогичного добавлению выражений print в ваш код — вы можете просматривать значения переменных в любой удобный вам момент времени. Однако во вкладке Locals вы также можете редактировать значения переменных. Это может оказаться полезным в случае, если вы нашли неверно установленную переменную и хотите проверить, пропадёт ли проблема при установке правильного значения.

Другая полезная функция MonoDevelop — пошаговое выполнение. Когда выполнение приостановится на точке останова, станет доступна шкала отладочных инструментов в верхней части окна MonoDevelop:-

Инструменты пошаговой отладки MonoDevelopИнструменты пошаговой отладки MonoDevelop

Первые четыре кнопки известны как Continue (продолжить), Step Over (шаг через), Step In (шаг внутрь) и Step Out (шаг наружу) и могут срабатывать по командам из меню Run (самая правая кнопка, Detach может быть использована для окончания отладочной сессии). Continue продолжает выполнение до очередной точки останова. И Step Over и Step In выполняют одну строку кода в один момент времени. Различия между ними в том, что Step Over полностью выполняет любые функции за одну линию, а Step In позволяет “шагнуть” внутрь функции. Так зачастую можно случайно использовать Step In для корректно работающих функций, существует Step Out, который продолжит выполнение до конца текущей функции и остановится снова в коде, который её вызвал.

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

MonoDevelop

MonoDevelop is the integrated development environment (IDE) supplied with Unity. An IDE combines the familiar operation of a text editor with additional features for debugging and other project management tasks. The text editor will not be covered here since it is fairly intuitive, but the integration of the editor and debugger with Unity are described below.

Setting Up MonoDevelop

MonoDevelop is installed by default with Unity, although there is the option to exclude it from the installation on Windows. You should check that MonoDevelop is set as the external script editor in the Preferences (menu: Unity > Preferences and then select the External Tools panel). With this option enabled, Unity will launch MonoDevelop and use it as the default editor for all script files.

Setting Up the Debugger

To enable MonoDevelop’s source level debugging (see below for details) you should firstly check that the Editor Attaching option is enabled in the Preferences on the External Tools panel. Then, you should synchronize the Unity project with the MonoDevelop project (menu: Assets > Open C# Project). Also, make sure that the Development Build and Script Debugging options are enabled in the Build Settings for your target platform (menu: File > Build Settings). If you are building a webplayer then you should additionally check that the development release channel setting is enabled on the player’s context menu in the browser (right click on Windows or cmd-click on Mac OSX).

Enabling debugging in the webplayerEnabling debugging in the webplayer

Just before starting a debugging session, select the target you wish to debug from the target list next to the play button (Unity Editor, OSX Player, etc.). You can also select “Attach To Process”, this will show the full list of debuggable Unity processes.

Play button and target listPlay button and target list

With these steps completed, you are ready to being debugging your Unity scripts by clicking the play button.

Source Level debugging

The currently open source files are shown as tabs in MonoDevelop and can be edited there with the features of a standard text editor. However, there is also a grey breakpoint bar to the left of the editor panel. Clicking in this bar will add a so-called breakpoint marker next to the line of code.

Читать:
Как играть в герои 3 hota по сети

Breakpoint being added to code on line 16Breakpoint being added to code on line 16

Adding a breakpoint to a line instructs Unity to pause execution of the script just before it reaches that line during Play mode. When the script is “frozen” like this, you can use the debugger to determine exactly what the script is doing.

The arrow shows execution paused at the breakpointThe arrow shows execution paused at the breakpoint

Information about the state of execution is shown in the tabs at the bottom of the MonoDevelop window when execution is paused at a breakpoint. Perhaps the most important of these is the Locals tab.

Tab showing variable valuesTab showing variable values

This shows the values of local variables in the function that is currently executing. (A pseudo-local variable called “this” is automatically available in every function without being explicitly defined; it is a reference to the current script instance and so all variables defined in the script can be accessed via “this”.) You can use breakpoints in combination with the Locals tab to get a similar effect to adding print statements to your code — you can interrogate the values of variables at any point you like. However, you can also edit the variable values in the Locals tab. This can be handy when you find a variable incorrectly set and you would like to see if the problem disappears when the value is set how it should be.

A further useful feature of MonoDevelop is single stepping. When execution is paused at a breakpoint, a bar of debugging tools will become available in the top portion of the MonoDevelop window:-

MonoDevelop stepping toolsMonoDevelop stepping tools

The four buttons are known as Continue, Step Over, Step In and Step Out and can also be accessed as commands on the Run menu. Continue resumes execution until the next breakpoint is encountered. Step Over and Step In both execute one line of code at a time. The difference between the two is that Step Over executes any function calls within the line all at once, while Step In allows the stepwise execution to continue into the function. Since it is common to use Step In accidentally on a function that is known to be correct, Step Out continues execution to the end of the current function and then pauses again in the code that originally called it.

A detailed description of source level debugging techniques is not appropriate here but there are various books and web resources offering wisdom on the subject. Additionally, a little experimentation will help you get a feel for the power of the technique and how you can use it to track down most common types of bugs.

Download

Source code is available on GitHub (viewing only) or as a Tarball.

Visual Studio for Mac is available to install

Visual Studio for Mac builds on top of MonoDevelop, adding open sourced internals from Visual Studio and many new extensions to support new workloads. To get the latest available version, switch to the Stable updater channel after installing.

Supported on macOS 10.11 and later.

MonoDevelop for macOS is available from source

Please refer to the building guide for more information about how to install and configure your MonoDevelop.

1 Add the Mono repository to your system

The package repository hosts the packages you need, add it with the following commands.

Note: the packages should work on newer Ubuntu versions too but we only test the ones listed below.

Ubuntu 18.04 (i386, amd64, armhf)

Ubuntu 16.04 (i386, amd64, armhf)

Ubuntu 14.04 (i386, amd64, armhf)

2 Install MonoDevelop

The package monodevelop should be installed for the MonoDevelop IDE.

3 Verify Installation

After the installation completed successfully, it’s a good idea to run through the basic hello world examples on this page to verify MonoDevelop is working correctly.

1 Add the Mono repository to your system

The package repository hosts the packages you need, add it with the following commands.

Note: the packages should work on newer Debian versions too but we only test the ones listed below.

Debian 10 (i386, amd64, armhf, armel)

Debian 9 (i386, amd64, armhf, armel)

Debian 8 (i386, amd64, armhf, armel)

2 Install MonoDevelop

The package monodevelop should be installed for the MonoDevelop IDE.

3 Verify Installation

After the installation completed successfully, it’s a good idea to run through the basic hello world examples on this page to verify MonoDevelop is working correctly.

1 Add the Mono repository to your system

The package repository hosts the packages you need, add it with the following commands.

Note: the packages should work on newer Raspbian versions too but we only test the ones listed below.

Raspbian 9 (armhf)

Raspbian 8 (armhf)

2 Install MonoDevelop

The package monodevelop should be installed for the MonoDevelop IDE.

3 Verify Installation

After the installation completed successfully, it’s a good idea to run through the basic hello world examples on this page to verify MonoDevelop is working correctly.

1 Add the Mono repository to your system

The package repository hosts the packages you need, add it with the following commands in a root shell.

Note: the packages should work on newer CentOS versions too but we only test the ones listed below.

CentOS 7 (x86_64)

CentOS 6 (x86_64, i686)

2 Install MonoDevelop

The package monodevelop should be installed for the MonoDevelop IDE.

3 Verify Installation

After the installation completed successfully, it’s a good idea to run through the basic hello world examples on this page to verify MonoDevelop is working correctly.

MonoDevelop for Windows is available from source only

Please refer to the building guide for more information about how to install and configure your MonoDevelop.

Как вернуть MonoDevelop в unity?

Внезапно пропала моно и вместо нее стал открываться Visual studio. Пытался скачать с офф сайта, установить xamarin studio, но все VS открывается. В preferences только browse и открыть стандартной программой для данного расширения есть. Два раза переустановил юнити (при удалении говорит что все связанные файлы удалит, но при повторной установке и запуске сразу кидает на окно выбора проекта с уже залогиненой учётной записью, будто ничего и не было) Помогите пожалуйста, VS, Xamarin итд не подходят мне из-за времени запуска и после запуска компьютер просто ложится на лопатки и виснет даже в браузере, а также нет подсказок, поэтому пришлось заморозить проект до решен я проблемы

Похожие статьи