Search Unity

Unity debugging with Xamarin

Discussion in 'Editor & General Support' started by ApeCoder, Mar 10, 2013.

  1. ApeCoder

    ApeCoder

    Joined:
    Mar 10, 2013
    Posts:
    2
    Hi,

    Recently I switched from Mono Unity build in to Xamarin. Xamarin is awesome. After I changed unity preference -> External Script Editor, I can sync with Xamarin as well. However, I didn't figure out how I can debug in unity with Xamarin. Previously with Mono buildIn, I could attach mono to unity but in Xamarin there is no such option. In forum, I saw someone mentioned https://github.com/Unity-Technologies/MonoDevelop.Debugger.Soft.Unity but have no idea how to use it. Any ideas?

    Thanks in advance,

    Ke
     
  2. ApeCoder

    ApeCoder

    Joined:
    Mar 10, 2013
    Posts:
    2
    I found MonoDevelop buildIn has Unity addIns: MonoDevelop.Debugger.Soft.Unity and UnityUtilities.dll which are built from https://github.com/Unity-Technologies/MonoDevelop.Debugger.Soft.Unity. I tried to copy those two to Xamarin AddIns folder and saw "Attach to process" option now. However, those two addIns are not loaded properly in Xamarin because they have dependencies on MonoDevelop v.28 rather than v4.0. Any idea how to update this version in MonoDevelop.Debugger.Soft.Unity project?
     
  3. burtonposey

    burtonposey

    Joined:
    Sep 8, 2009
    Posts:
    62
    I'd love to get this working too. I'm in the dark when it comes to exactly how to build it and I don't have Visual Studio, but I can tell you I see those dependencies explicitly stated in the Manifest.addin.xml file. I would start with changing the 2.8 to 4.0.

    Let me know how it goes.
     
  4. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,798
    If integrating Xamarin with Unity was so easy that it only requires simple replacement of the existing files and a few XML changes, I'm pretty sure that would have been already done by either UT or Xamarin. ;)
     
  5. fluxa

    fluxa

    Joined:
    Sep 8, 2009
    Posts:
    16
    There's a branch on github from the MonoDevelop.Debugger.Soft.Unity project called "bleeding-edge" which seems to be a work in progress for the MD4 (Xamarin) addin. Look at the dependencies in the Manifest.addin.xml . I tried to compile the project but it failed due to missing references (Mono.Core / MonoDevelop.TextEditor / Mono.Debugging.Soft / Mono.Debugging.Client ), if any of you can get it to work it would be awesome ;)
     
  6. _Max_

    _Max_

    Joined:
    Feb 21, 2013
    Posts:
    160
    Where is the full guide to doing this?
     
  7. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,798
    Hmmm... A guide? :confused: I'm just saying it isn't that simple, otherwise it would be already done by Unity Technologies since I guess they are more than aware of our complains about MonoDevelop 2.8. The MonoDevelop which ships with Unity is a modified version of the original MD 2.8 customized to work with Unity, i.e. it supports UnityScript (and maybe Boo) in addition to its default support for C#, and has syntax highlighting for Unity's ShaderLab. So all that customization would have to be done by UT again in MD 4.0 or whatever future version... There were suggestions from users to UT to implement the support for Unity as a plugin for MD so that users can upgrade to newer versions of MD whenever they are released, but there's been no announcement so far that something like that may happen.

    If you're fine to use Xamarin only for C# code editing and not for debugging then go for it. I tried that and I dropped it in only a couple of days as it turned out Xamarin is still the old MD with iTunes skin. There are a lot of improvements in the code refactoring and code analysis area due to the upgraded NRefactory library used in MD 4.0, so it comes closer to as you're using Resharper, but there were still numerous bugs in the Xamarin GUI, some of them too annoying to let me stay focused on programming. That might improve though after some time, but for now I've decided to not use Xamarin. ;)
     
  8. _Max_

    _Max_

    Joined:
    Feb 21, 2013
    Posts:
    160
    Thanks for the summary, excellent post :).

    I will look into this, I really think Unity team should think of something soon as more and users requesting update as you mentioned.

    Regards,
    Max
     
  9. kurifu

    kurifu

    Joined:
    Nov 20, 2012
    Posts:
    3
  10. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,798
  11. stephan7

    stephan7

    Joined:
    Jul 3, 2012
    Posts:
    44
    Very cool.

    Worked meanwhile a little bit with it. Much more responsive. MonoDevelop 4 is much better, e.g. the command "Find References" returns the results immediately! :)

    A small glitch:
    - _before_ attaching the debugger to the Unity editor process one has to start the play mode in editor
    - after debugging one has to Detach the Debugger first and afterwards one can stop the editor play mode

    If I don't do this in this order Unity crashes.

    Thanks,

    Stephan
    --
    http://www.software7.com
     
  12. kovalgek

    kovalgek

    Joined:
    Sep 2, 2012
    Posts:
    1
    Someone can explane me - how to connect xamarin with unity3d? i can understand how to do this(
     
  13. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    945
    Oh man, this is gold!! Can't wait to try it!!
     
  14. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    945
  15. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    I think it was aras who recently has shown a sneak peak of editor work they are doing where it was clearly mono develop 3+ that was to be seen so they are working on it.

    Also its not directly the mono dev version. Unity 3.4s mono dev version for example ran 10 times as fast as anything since 3.5 on osx at least, you could even use find reference.
    so it seems that the internal fork potentially has impacted the whole situation too in one or more ways.

    Unless you are on OSX its not that relevant as the #1 way to go is Visual Studio + UnityVS (+ Resharper), anything else is 2 dimension jumps backward
     
    twobob likes this.
  16. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    945
    I'm on OSX so unfortunately I can't use Visual Studio, so this is a huge deal for me... Not sure why this thread hasn't more relevance. So many people complaining about Monodevelop 2.8 and apparently you can use a much more updated version with no sweat.
     
  17. burtonposey

    burtonposey

    Joined:
    Sep 8, 2009
    Posts:
    62
    Thanks for doing this kurifu!

    I got it set up (just installed it to my /Applications folder and pointed Unity to use it as the external code editor) and I'm having trouble launching my game when I've attached to the Unity process. It crashes Unity (I'm running version 4.1.0f4) every time.

    If I just load Unity back up and don't attach it works fine.

    Had you experienced anything like this? Thanks for the help.
     
  18. runonthespot

    runonthespot

    Joined:
    Sep 29, 2010
    Posts:
    305
    I think it's worth pointing out that if you've got VMWare fusion, and want to do VS on Mac with Unity, @quickfingerz uses it (with Resharper) and built a few tools to make it all hang together (including double clicking on a script error in Unity to open in appropriate place in VM Visual Studio).

    Worth a shot, and I understand that this is how he runs his own workflow.

    http://www.quickfingers.net/visual-studio-unity-mac-the-finale/
     
  19. Ghopper21

    Ghopper21

    Joined:
    Aug 24, 2012
    Posts:
    170
    @kurifu - THANKS for this! Is this what has become the Utilities for use with Unity add-in for Xamarin Studio (available via the Add-in Manager)? If so, does it work with the latest version of Xamarin? I ask because I've installed it but don't see any instructions for how to do debugging, e.g. I don't see any Attach to Process option as in MonoDevelop. Is there some other way to invoke the debugger?
     
    dd_pete and IQpierce like this.