# Reliably debugging C# script?

**URL:** https://discussions.unity.com/t/reliably-debugging-c-script/499461
**Category:** C# & .NET
**Tags:** Scripting
**Created:** [March 10, 2013, 9:37am UTC](https://discussions.unity.com/t/reliably-debugging-c-script/499461 "2013-03-10T09:37:52Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![PompeyPaul](https://avatars.discourse-cdn.com/v4/letter/p/4bbf92/32.png) [@PompeyPaul](https://discussions.unity.com/u/PompeyPaul)
#### Post date: [March 10, 2013, 9:37am UTC](https://discussions.unity.com/t/reliably-debugging-c-script/499461/1 "2013-03-10T09:37:52Z")

</div>

I am using Unity 4.0.1f2 on Windows 8 64 bit.

I am finding it hard to reliably debug my script. I find if I run “Debug” from MonoDevelop with F5 then I get the following error:

> [@](#):
>
> It looks like another Unity instance is running

So I shut down Unity with my project. I then hit F5 again and this time Unity starts, I can then set breakpoints and debug my code fine.

However if I stop the in game view, and then set more breakpoints then press play again the new breakpoints, and even the old breakpoints, aren’t recognised or hit.

So basically everytime to debug I have to kill Unity, then hit F5 in MonoDevelop, then when Unity starts hit the play button - which is a very slow work flow.

How should debugging actually work? Is there some way I am meant to attach to processes rather than hit F5 to debug?

---

<div class="post-metadata">

### Author: ![PompeyPaul](https://avatars.discourse-cdn.com/v4/letter/p/4bbf92/32.png) [@PompeyPaul](https://discussions.unity.com/u/PompeyPaul)
#### Post date: [March 10, 2013, 12:49pm UTC](https://discussions.unity.com/t/reliably-debugging-c-script/499461/2 "2013-03-10T12:49:08Z")

</div>

I figured this out. I was hitting “stop” for debug in MonoDevelop. If I just leave it “running” then I can edit stuff, press “play” and “pause” in the unity viewer and everything is fine. Just important not to “stop” debugging in MonoDevelop.
