Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging with unity

At the current moment, what I'm doing is that I'm opening Unity, double click on one of those scripts I've written, then MonoDevelop gets opened, now I have to close unity and in MonoDevelop I do Run >> Run with >> Unity Debugger.

After this Unity gets opened and when I press the play button in unity the debugging session starts. But once only. If I stop this session in either Unity or MonoDevelop I have to repeat this whole procedure all over again, which is very tedious. I have to open Unity, close Unity, (I have to close it because next step which is Run >> Run with >> Unity Debugger will open unity and if unity is already opened I'm getting error saying that only one instance of unity can open one project at a time).

What I'm asking is:
Is there any better workflow which would free me from this tedious switching on and off Unity, and every time I stop debugging session I would just start normally without doing these tedious repetitions?

like image 872
smallB Avatar asked May 27 '12 16:05

smallB


People also ask

How do you debug in Unity?

Enable script debugging in a Unity player In Unity, open the Build Settings by selecting File > Build Settings. In the Build Settings window, mark the Development Build and Script Debugging checkboxes.

How do you debug an app in Unity?

To debug a Unity application on a local computerMake sure the project you want to debug is opened in the Unity editor. In JetBrains Rider, open the corresponding Unity project solution. Set breakpoints by clicking the gutter next to a required line of code. Select the Attach to Unity Editor & Play run configuration.

How do I debug Unity standalone?

In Visual Studio for Mac, with your Unity project opened, do Run -> Attach to Process, and select Unity Debugger. This will show you the list of Unity processes you can debug. For this to work, you game player has to be exported with the debug options, and of course, to be running.

How do I link Unity and Visual Studio?

Install Visual Studio and UnitySelect Install, or Modify if Visual Studio is already installed. Select the Workloads tab, then select the Game development with Unity workload. If Unity isn't already installed, select Unity Hub under Optional. Select Modify or Install to complete the installation.


1 Answers

Use 'Attach' in MonoDevelop's debug menu; you should be able to attach to the running Unity process that way. (You may need to ensure that the appropriate option is turned on in Unity's preferences).

like image 178
Superpig Avatar answered Sep 28 '22 23:09

Superpig