Search Unity

Unity Add-ins for MonoDevelop/Xamarin Studio 5.9+

Discussion in 'Scripting' started by lukaszunity, Jun 1, 2015.

Thread Status:
Not open for further replies.
  1. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461


    Important: These add-ins are no longer being updated!




    We are at Unity currently in process of updating MonoDevelop to version 5.9, which is the same version that Xamarin Studio 5.9 is based upon. However, it might be a while before MonoDevelop 5.9 is actually shipped with a Unity release.

    To reduce the waiting time we are now releasing the Unity Add-ins (Boo/UnityScript/Debugger) for MonoDevelop/Xamarin Studio 5.9 for early testing and feedback.

    This means that by installing Xamarin Studio 5.9 and installing the Unity Add-ins below, you can now use Xamarin Studio 5.9 for opening, building and debugging any Unity generated MonoDevelop project/solutions. We have also implemented a new feature so now you can attach to the Unity editor, platform/web/iOS/Android players from the target selector directly without using the attach to process dialog.


    We will be monitoring this thread for user feedback, so please let us know if you have issues or requests for the add-ins. We are especially interested in any issues you might encounter with the debugging; broken/incorrect behavior, Unity locks up, etc.

    It would be very help to us if you could report any issues you encounter through Unity’s bug reporter (open Unity, Help ➔ Report a bug...) and attach a project which reproduces the issue and post the case number for the bug in this thread. Providing a Unity project with a bug report makes it much easier for us to reproduce and resolve issues.

    Please check the minimum requirements, as a recent patch release of Unity is required for these add-ins to work correctly.

    Download

    Unity Add-ins 5.9.1: http://files.unity3d.com/lukasz/Unity-Addins-5.9.1.zip

    Minimum Requirements

    MonoDevelop/Xamarin Studio: 5.9 or above: http://www.monodevelop.com/download
    Remember to install the required packages as well!

    Unity 4.6+: 4.6.5p2 or above
    Unity 5.0: 5.0.2p2 or above
    Unity 5.1+: 5.1.0p1 or above

    Unity patch releases are available here: https://unity3d.com/unity/qa/patch-releases

    Installation
    • Unpack the zip file. You will now have 4 files with an .mpack extension.
    • Open MonoDevelop/Xamarin Studio.
    • Open Add-In Manager
      • OSX: Xamarin Studio ➔ Add-in Manager.
      • Windows: Tools ➔ Add-in Manager
    • Click "Install from file" and select the 4 .mpack files.
    • Restart MonoDevelop/Xamarin Studio.
    • You should now be able open, build and debug any Unity generated solution/projects.

    New features

    • Attach to Unity Editor, OS/Web/iOS/Android player using target selector.
    Not supported
    • Boo/UnityScript: Code completion and source navigation.
    • Debugger: Launching Unity from MonoDevelop/Xamarin Studio.
    FAQ
    • Unity crashes when I start debugging.
      Make sure you have the Unity versions listed in Minimum Requirements or newer installed.
    • After setting Xamarin Studio as my External Script Editor, Xamarin Studio does not open the solution when I click a script in Unity.
      You need to “Sync MonoDevelop Project” from the “Assets” menu in Unity to make Xamarin Studio open the solution.

      Alternatively, if you have "MonoDevelop" (case does not matter) in the path to your Xamarin Studio installation, then Unity will open the solution like for MonoDevelop.

      For instance if your Xamarin Studio path is "<something>/MonoDevelop/Xamarin Studio"
    • Attach to Process Dialog is shown when trying to attach to a target from the drop down list.
      This dialog will be shown if there is more than 1 instance of that target running. E.g. will happen when “Unity Editor” is selected and you have multiple instances of Unity Editor running.
    Changelog:

    Unity Add-ins 5.9.1 - http://files.unity3d.com/lukasz/Unity-Addins-5.9.1.zip
    • Fix issue with breakpoint properties condition input field being disabled.
    Unity Add-ins 5.9.0 - http://files.unity3d.com/lukasz/Unity-Addins-5.9.0.zip
    • Initial release
    Source code repositories
     
    Last edited: Aug 25, 2015
  2. seon

    seon

    Joined:
    Jan 10, 2007
    Posts:
    1,441
    Awesome... thanks.

    So, I added the files and restarted Xamarin Studio. When I double click a script in Unity, it opens the script, but not the solution. This is just like the behaviour without the add-ins.

    Is that intended behaviour?

    As it is, I have to use the "Sync MonoDevelop Project" every time I start up Unity.

    I'd expect the solution gets loaded just like when using MD.

    Edit: Hmm, I seemed to have missed the 5.0.2p2 and above bit... I am on 5.0.2f1.

    Should that really prevent solutions from auto loading?
     
    Last edited: Jun 1, 2015
  3. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    We have special case handling for MonoDevelop in Unity, so if you have "MonoDevelop" (case does not matter) in the path to your Xamarin Studio installation, then it will open the solution like for MonoDevelop.

    For instance if your Xamarin Studio path is "<something>/MonoDevelop/Xamarin Studio"
     
    Last edited: Jun 1, 2015
  4. seon

    seon

    Joined:
    Jan 10, 2007
    Posts:
    1,441
    Wow, that's ugly. Can you just not get it opening the solution no matter what? Change in the next patch maybe?
     
  5. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    The reason we do not always open the solution is because not all script editors support solutions.

    I'll add doing special handling for Xamarin Studio on my todo list.
     
    MakingFun likes this.
  6. seon

    seon

    Joined:
    Jan 10, 2007
    Posts:
    1,441
    Thanks Lukasz!
     
  7. voldemarz

    voldemarz

    Joined:
    Sep 19, 2011
    Posts:
    25
    Removing breakpoints after attaching the debugger doesn't seem to work, they still get hit. Using Xamarin 5.9.1 (build 3) and Unity 4.6.5p3. Is it a know issue?
     
  8. SonicBloomEric

    SonicBloomEric

    Joined:
    Sep 11, 2014
    Posts:
    1,090
    Perhaps you could add a toggle that allows developers to set whether or not the Solution should be opened? This could help alleviate the need for "magic directory structures", make the distinction clear to the user (provide insights into "why" things don't work), and provide a suggestion that the user should check for Solution support in their favorite editor.

    A tooltip could give a more technical explanation for what's happening: "Not all editors support solutions. Enable only if your editor supports Visual Studio-style Solutions."
     
    Novack likes this.
  9. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    Great news. Going to check it out now. One question though - does MonoDevelop still exist ?

    Even the download page links to Xamarin Studio (http://www.monodevelop.com/download/)
     
  10. knotFF

    knotFF

    Joined:
    Apr 13, 2013
    Posts:
    66
  11. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    @FF1978 I am not sure highlighting is part of the AddIn. They both can be extended with different highlighting schemes (or did you use the same one for both ?)
     
  12. Mishaps

    Mishaps

    Joined:
    Nov 28, 2011
    Posts:
    181
    This is great news thank you! No problems so far 5.0.2p3 and xam 5.9.2 (build 2). The "include /MonoDevelop/ in application path" tip was really helpful too.
     
  13. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    598
    One thing I'm noticing is that every time that a compile error in the Unity console is clicked it opens a new instance of Xamarin.
    When pointing to MonoDevelop and a console log is clicked, it opens the file in the same MonoDevelop instance.

    I'm using Unity 4.6.5p3
     
  14. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    Are you having this issue with the editor or a player? If you could submit a bug report with a small repro project, that would be very helpful. Thanks.
     
  15. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    I think it would make sense to add this if there were other editors out there that supported VS-style solutions besides VS/XS/MD, but I am not aware of any. For VS/MD/XS we will keep the special handling, so it always works out of the box.
     
  16. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    Yes, MonoDevelop does still exist, but no one is releasing builds of it as far as I know. You can build it from source, which I have been doing when developing these add-ins :)

    Xamarin Studio is branded version of MonoDevelop with some additional features.
     
  17. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    For C# we do not provide any special syntax highlighting and just use the built-in one.
     
  18. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    Thanks for reporting this, I will add this my list of issues to fix.
     
    lermy3d and MakingFun like this.
  19. siddartha_

    siddartha_

    Joined:
    Apr 17, 2013
    Posts:
    11
    I used to have the "Mono Soft Debugger Support for Unity" and the "Utilities for use with Unity" installed from Xamarin's Add-in repo (beta channel I think..)
    Isn't it possible to publish these updates through that channel so we get notified of new updates automatically?
     
    pjezek likes this.
  20. voldemarz

    voldemarz

    Joined:
    Sep 19, 2011
    Posts:
    25
    The issue happens when I attach to editor. I'm on OSX 10.10 by the way.

    I submitted a bug, but am not receiving a confirmation with case ID. It submitted it with email valdis [at] sybogames.com.
    I attached a repro project to the post, but it's almost empty, contains default scene with camera and a script with one Debug.Log in Start() function.

    Repro steps:
    1. Place breakpoint in Start() function
    2. Attach debugger
    3. Remove breakpoint
    4. Launch play session in editor and notice that debugger stops where breakpoint used to be
     

    Attached Files:

    TerrenceRao likes this.
  21. StephanK

    StephanK

    Joined:
    Jul 10, 2012
    Posts:
    47
    I followed the instructions and setup xamarin 5.9.1 with your addins. Opening/syncing from unity works. If I compile the project inside Xamarin it fails. So the compiler used by Xamarin seems to be a different one than the unity one. In this specific case it can't deal with a method that expects a delegate () where we pass a method with optional parameter like: MyMethod(bool b = false). The unity compiler accepts this, the built-in monodevelop as well, but Xamarin doesn't. How can we configure Xamarin to use the same compiler?
     
  22. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,338
    In general, it would be great to have more options on opening things. I'd like to have UnityScript (and BOO) files be opened in MonoDevelop, C# files be opened in Visual Studio, and shaders be opened in Notepad++. Right now, that's impossible.
     
    SonicBloomEric likes this.
  23. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    Once we ship MonoDevelop 5.9 with Unity, we will no longer release updates to the Unity add-ins for Xamarin Studio.

    Since we will not be maintaining compatibility with Xamarin Studio going forward, we will not be publishing them through the official add-in repository.
     
    lermy3d likes this.
  24. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    Thanks for the details, we will investigate this issue.
     
  25. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    Could you post a complete code snippet that does not compile?
     
  26. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    For general feature requests please use http://feedback.unity3d.com/ or submit a feature request through the bug reporter.
     
    lermy3d and adnanshafiq97 like this.
  27. knotFF

    knotFF

    Joined:
    Apr 13, 2013
    Posts:
    66
    Yeah, the same one for both. (Monokai scheme).
     
  28. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,796
    Seems like you have Semantic Highlighting enabled in MD and not in XS.
     
  29. knotFF

    knotFF

    Joined:
    Apr 13, 2013
    Posts:
    66
    Any idea where I can enable it? Because it's not there on XS preferences.
    http://gyazo.com/779a447a9b4abd28e2566708ed1d3491
    XS in on the left and MD on the right
     
  30. sstulov

    sstulov

    Joined:
    May 22, 2013
    Posts:
    1
    Have you tried enabling "Enable semantic highlighting"? Without it the highlighting is "poorer". Not sure if this option is present in Xamarin though.
     

    Attached Files:

  31. knotFF

    knotFF

    Joined:
    Apr 13, 2013
    Posts:
    66
    If you look at this link image you will see the options is not there, even though on Xamarin website it states that there is:
    http://gyazo.com/779a447a9b4abd28e2566708ed1d3491
     
  32. pjezek

    pjezek

    Joined:
    Jun 10, 2009
    Posts:
    18
    Awesome... thanks.

    @lukaszunity will you still provide the Add-in as separate bundle so we can try to use latest XS (without support)?
     
  33. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    We will not providing the add-ins as separate releases once we ship MonoDevelop 5.9. However, you could copy the add-ins manually from the MonoDevelop we ship and try them out in the latest Xamarin Studio. There is no guarantee that this will work and it is not something we will officially support.
     
    pjezek likes this.
  34. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,276
    The autocomplete for JS/UnityScript is very poor compared to C# in the current MonoDevelop (Unfortunately must use js in this 1 case). Will this improve with the new MonoDevelop?
     
  35. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    Currently the new add-ins do not support code completion for the Boo/UnityScript and if we eventually implement it, it will work exactly as in the current MD 4.0.1 and there are no plans to improve it. We highly recommend to use C# instead.
     
  36. voldemarz

    voldemarz

    Joined:
    Sep 19, 2011
    Posts:
    25
    Enums still tend to appear unloaded sometimes (maybe always, don't remember seeing them working). This was issue also in MonoDevelop.

    Also, inspection of IList<T> (where T is struct) shows "The request is not supported by the protocol version implemented by the debugee".
     
  37. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    Thanks for reporting these issues, I've added them to my list of issues to fix.
     
    lermy3d likes this.
  38. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    This is an issue in Xamarin Studio and will be fixed in an upcoming release.

    You can work around this by launching Xamarin Studio manually the first time, then all scripts that are clicked in Unity will be opened in this instance.

    Also, you can also set "External Script Editor Args" to "$(File);$(Line)" (quotes included) to have Xamarin Studio open the script file at the correct line when clicking build warnings and errors.

    This information has been added to FAQ.
     
    lermy3d likes this.
  39. Peter_1

    Peter_1

    Joined:
    Jan 21, 2014
    Posts:
    4
    Hi Lukas, if we are now able to use Xamarin Studio, when will we be able to include Xamarin Portable Class Libraries (PCL) in our Unity projects?
     
  40. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    If I understand your question correctly, you want to use PCL to setup your Unity projects for different platforms? The build process and solution/project generation for MonoDevelop/Xamarin Studio 5.9 is unchanged compared to MonoDevelop 4.0.1 and we therefor do not support PCL in the project/solutions.

    In Unity 5 you can use the Plugin Inspector to manage which plugins (native and managed) you want to use for specific platforms.
     
  41. Peter_1

    Peter_1

    Joined:
    Jan 21, 2014
    Posts:
    4
    Exactly, I would like to use a PCL to expose the Microsoft Azure API packages as a common interface across different platforms in my Unity project. As the Bit Rave plugin doesn't appear to be that well supported and the Prime31 plugin is Microsoft specific, I was looking to produce our own solution.
    My assumption was that I could build a PCL and import it into Unity as a native plugin - the PCL dll being effectively just object code to the Untiy/Mono compiler - rather than a managed plugin where the Unity/Mono compiler actually has to manage the dll integration. However, using the Plugin Inspector I can't amend the plugin type from Managed to Native, which I assume is due to the PCL being written in C#?
    I understand that I would have to use DLLImport in my scripts in this case and may have to use DLLExport (NuGet UnmanagedExports) within the PCL, but in my simplistic way don't quite understand why I can't use a PCL as a Native plugin in Unity?
     
  42. Peter_1

    Peter_1

    Joined:
    Jan 21, 2014
    Posts:
    4
    Actual I suppose Unity picks up the PCL as a Managed plugin as it has .NET Framework 4.5 as a target?

    Unity then complains as it is .NET 4.5 rather than .NET 3.5 (I'm getting Unhandled exception errors).

    Problems with Xamarin Studio 5.9 and Unity 5.1 being too 'helpful'!
     
  43. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    Our Mono does not support .NET 4.5, you need to target .NET 3.5.
     
  44. Peter_1

    Peter_1

    Joined:
    Jan 21, 2014
    Posts:
    4
    Why doesn't Unity 5.1 allow me to change the plugin Type from Managed to Native?
     
  45. frarees

    frarees

    Joined:
    Jun 8, 2012
    Posts:
    36
    Add-ins 5.9.0 crashing constantly using Xamarin 5.9.3 when debugging. It happened after updating from 5.0.1p3 to Unity 5.1.0f3. Any ideas how to debug this issue?
     
  46. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    The plugin inspector determines the plugin type based upon the PE header. I don't quite understand why you want to change a managed plugin to a native plugin.
     
  47. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    You need to get Unity 5.1.0p1 to fix Unity crash when attaching.

    https://unity3d.com/unity/qa/patch-releases
     
  48. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    Updated June 22nd 2015. Changes are marked with strike through

    It has now been a couple of weeks since the Unity Add-ins were released and I want to give a short status update on the outstanding reported issues and I have categorized them into Unity and Xamarin Studio issues.

    Unity Issues
    1. Crash when inspecting enums.
      Has been fixed.

    2. Open solution in Xamarin Studio when clicking a script in Unity
      Has been fixed. See FAQ at top for work-around.

    3. Reported through Unity Bug Reporter: Inspecting struct properties in MonoDevelop debugger that only have getter crash Unity, e.g. Sprite.bounds.
      Has been fixed.
    Xamarin Studio Issues
    1. Breakpoints still trigger after being removed
      A fix has been submitted and accepted by Xamarin. Work around is to detach and attach to make the breakpoints not trigger.

    2. Clicking a build error/warning in Unity opens a new instance of Xamarin Studio on Windows
      A fix has been submitted, still waiting for Xamarin to accept it. See FAQ at top for work-around.

    3. Inspection of IList<T> (where T is struct) shows "The request is not supported by the protocol version implemented by the debugee"
      Additional logic needs to be implemented in Unity's version of the Mono from 2011 to support the latest protocol. Work will start on this soon, it is currently unclear how long this task will take.
      MonoDevelop debugger must be patched to fall back to an older version of the protocol. Work will start on this soon.

    4. "The requested item has been unloaded" error message when inspecting enums.
      Has been fixed in Unity. This an issue in the MonoDevelop debugger and the process for fixing this has been started.
    We are finishing work on Unity the issues and they should be available in Unity patch-releases soon.

    When the Xamarin Studio fixes will be available is out of our control, but once I know they have been included in an official release I will let you guys know.

    I will be at Unite Europe in Amsterdam next week, so if you are attending I'm available for a chat about most things related to scripting.
     
    Last edited: Jun 25, 2015
    pjezek likes this.
  49. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    I've updated my post above based upon further investigation and testing of the reported issues.
     
  50. Ox_

    Ox_

    Joined:
    Jun 9, 2013
    Posts:
    93
    I have a problem with Xamarin Studio 5.9.3 not seeing any of Unity, .NET or plugin classes.

    All these classes and namespaces are highlighted like errors and I can't go to their declaration (but my own classes inside the project are doing well).
    Code (CSharp):
    1. using UnityEngine;
    2. using System;
    3. using System.Collections;
    4. using System.Collections.Generic;
    5.  
    6. List<Tween> someList;
    7. Action someAction;
     
Thread Status:
Not open for further replies.