Search Unity

UnIDE - A Code Editor Integrated Into Unity

Discussion in 'Works In Progress - Archive' started by CorruptScanline, Oct 23, 2012.

  1. CorruptScanline

    CorruptScanline

    Joined:
    Mar 26, 2009
    Posts:
    217
    I have been working on an IDE/code editor for a few weeks. It is specifically designed for use with Unity and integrated right into the Unity UI.

    My goals for this project are to create a code editing solution for Unity that has all the features people want and use for day to day programming. I want this to be an alternative to MonoDevelop and Visual Studio, offering all the "must have" features of these and other IDE/text editors, such as:

    • Intuitive syntax aware text editing.
    • Context sensitive autocomplete/intellisense on par with Visual Studio.
    • Code Signature tooltips.
    • Find and Replace. with keyword highlighting.
    • Error and warning highlighting from Unity console data.
    • C#, UnityScript, and Boo support. (Boo and UnityScript support may be limited initially).
    • Quick navigation and search through your project to find the the files you need.
    • Collapsible side navigation bar with mouse-over expanding to maximize your programming workspace.
    • Extensibility, implements powerful plugin system. The autocomplete feature is implemented as a plugin.
    • Theme system to choose and customize the look of the editor.

    Heres a sceenshot of the current state of the editor.
    [Click for full size]


    The last large features I need to finish up are autocomplete, code tooltips and Find/Replace. Besides that its just small features and additional UI stuff.

    Some things I don't plan on adding, at least initially are things that you don't use day to day, such as large scale refactoring.

    Id like to hear suggestions for features that would take advantage of the fact that its integrated into Unity and shares the same API. These things could be visual editing for datatypes like Color, and Vector2/3/4, or a code snippet evaluator for doing quick editor scripting tasks without dedicating a full class and file for the snippet.
     
    Last edited: Oct 23, 2012
  2. Deleted User

    Deleted User

    Guest

    I really thing this is awsome :D. Did you have any information on ETA and price?
    Also a feauture that I´m missing in youre list ist Code folding and regions, that is somthing that I use quite a lot.
    And is it possible to create new scripts from your site navigation?
     
    Last edited by a moderator: Oct 23, 2012
  3. CorruptScanline

    CorruptScanline

    Joined:
    Mar 26, 2009
    Posts:
    217
    I would like to get it finished as soon as possible. Hopefully within the next week or two. As far as price I'm not really sure. I want to say no more than $50 right now. I also may release a free "lite" version.

    Code folding is definitely something that can be added. I don't think this would be too much work. I do plan on adding the ability to create scripts from the navigation panel, probably with customizable code file templates.
     
  4. xniinja

    xniinja

    Joined:
    Mar 12, 2011
    Posts:
    230
    Wow, this looks awesome. $50 would definitely be worth it.

    Also, just a quick idea I had when I was reading would be a minimization type system. For example, when you click off of the code editor it goes into a sidebar then when you click back on it goes into the normal size. May or may not work. Just and idea.
     
  5. BrUnO-XaVIeR

    BrUnO-XaVIeR

    Joined:
    Dec 6, 2010
    Posts:
    1,687


    Show this thing to UT, contact them and talk about having this built into the native editor; There's no reason for UT not paying for such good extension, we all know all those IDEs are very buggy, if this tool at least doesn't introduce MORE bugs than average is more than worth it...
    But buying as external add-on, I wouldn't pay much. $50 sounds a bit of to much when I already have 3 IDEs to work from.
    I mean just "sounds" expensive, but I know that making such a thingy is not even close of being easy... But hmm, we already have IDEs ;)
     
    Last edited: Oct 24, 2012
  6. landon912

    landon912

    Joined:
    Nov 8, 2011
    Posts:
    1,579
    I feature that I really wish they would have is, when I have a function or other stuff, that should be added to the auto complete, so should private vars.
     
  7. DaneC020

    DaneC020

    Joined:
    Mar 19, 2010
    Posts:
    191
    Awesome work. I was wondering when someone would develop something like this the other day, so I was happy to see this thread. It would be nice to have resharper support but I would only use this if it supported debugging. Without proper debugging tools, this wouldn't add much value over Visual Studios/Monodevelop. I only say that because having a window inside the editor is nice but most of the time my IDE is open on a second monitor which is one click away. With this solution I would most likely tear the window off to a second monitor since writing code in a small window would be a pita.

    -Dane
     
    Last edited: Oct 24, 2012
  8. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,796
    WOW, kurtloeffler that looks awesome! :) Seems like you've already surpassed the state of my Script Inspector, congrats!!!
     
  9. BrUnO-XaVIeR

    BrUnO-XaVIeR

    Joined:
    Dec 6, 2010
    Posts:
    1,687
    Looking at that screenshot, each letter look like sprites instead of simple text lines. Is that correct?
    Complicated stuff going on there.
    I like the coding style, looks almost the same of mine. Hate unnecessary empty lines, etc ;)
     
    Last edited: Oct 24, 2012
  10. Tiles

    Tiles

    Joined:
    Feb 5, 2010
    Posts:
    2,481
    Looks awesome. How fast is it? How fast does it load?
     
  11. Rond

    Rond

    Joined:
    Oct 21, 2009
    Posts:
    175
    HOLY! I always wanted this, man!
     
  12. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Would only consider it if it had source level debugging.
     
  13. kingcharizard

    kingcharizard

    Joined:
    Jun 30, 2011
    Posts:
    1,137
    UT was already(or planning to) developing something very similar to this.. This is nice, but I wouldn't buy this I already have VS and Mono Develop, I would however donate to you for developing such a tool..

    Here is something I would take into account.
    I think the unity editor is already pretty crowded for smaller screens(I have 1024x768 laptop screen) with the hierarchy,project panel, inspector, scene and game window this is just another thing cluttering it up, It could get pretty messy. I dunno if I'd prefer to switch tabs(inside unity) or windows(outside of unity) im not certain but I think you should try to make this clean looking as possible so people would want to use it and not have to worry about cluttering things up. so far its interesting.
     
    Last edited: Oct 24, 2012
  14. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,052
    Yea, I pretty much feel the same. It is a great idea, and if it was solid and quick, it might be nice for a quick edit here or there, but really hard to justify paying for yet another text editor. I someone else said, I would probably donate just because it is cool.

    I do think though, that it could be successful, especially if there was a way to extend/script for it. There are many folks just getting into programming and who, uh... erm.... aren't religiously dedicated to their tool of choice. (like me) ;)
     
  15. HolBol

    HolBol

    Joined:
    Feb 9, 2010
    Posts:
    2,887
    This looks fantastic.
     
  16. CorruptScanline

    CorruptScanline

    Joined:
    Mar 26, 2009
    Posts:
    217
    This is a good suggestion, I will definitely look into if programmatically resizing docked windows is possible, although I have a feeling its not, or may cause strange stuff to happen to other docked windows. I also want to look into using a global hotkey to show and hide the window so it could be docked with the scene view or game view and easily toggled with a key press. I hear UT is updating the window/docking systems so maybe that might help.

    The autocomplete will be very context sensitive, showing you everything you can access from the current scope/literal chain. I have been working on an expression resolver to resolve the expression left of the cursor to the correct type and static or instance state so I can use a combination of reflection and parser info to determine what items should be added to the autocomplete list. So simply typing any character when there is whitespace before it will result in seeing everything currently visible from the current scope and namespaces, and after typing a "." it will resolve the expression left of the "." and determine what should be added to the list.

    • gameObject.transform. will show all public members accessible from an instance of Transform.
    • (gameObject.GetComponent<MyCustomScript>()). will show public members in MyCustomScript.
    • 4567. will show public members form an instance of System.Int32.
    • ((UnityEngine.Object)new GameObject("ObjectName")). will show all public members from an instance of UnityEngine.Object.

    The item sorting and filtering uses a fuzzy search algorithm so you can could type "mecol" to find MeshCollider.

    The text is drawn with a GUI.Label for each line "element". Elements are things that are separated by formatting.

    The editor itself loads instantly. The time it takes to load a script depends on how large with script is. There is also some time dedicated to writing some asset files when loading, to ensure persistent data when going in and out of play mode, which seem to take about half a second. Then for a 3000 line file it takes about 1 more second on top of that. Its splitting the new line characters and building the lines and doing all the formatting for the entire document when loading. I could have the line formatting in a separate thread, but the bulk of the time is in the new line splitting it seems, which has to be done instantly. Its possible that this could be faster though. For loading your average script it should be ready to edit in less than 1 second after clicking it.

    Editing after a file is loaded should stay very fast because all intensive tasks such as autocomplete are done in a separate thread. On a slow computer you may have some slowness when scrolling if the window is really big, just because of how much text its rendering. I think there is some new text rendering stuff coming in future releases of unity that could make this faster. My graphics card is about 3 years old and I have no problem scrolling in full screen at 1920x1080.

    Screen space usage is a big priority for me. That is why I plan to have the side navigation bar be auto-collapsible so the editor window is almost completely filled by the text editor.
     
  17. Quickfingers

    Quickfingers

    Joined:
    Aug 29, 2009
    Posts:
    268
    always 1 step ahead aren't you kurt :p I was planning on making exactly this, but now... I think I'll just wait for yours
    :)

    What would really put this as a ground breaking solution in my eyes is if the autocomplete would be aware of all your classes written in all different languages. So c# will be autocomplete aware of stuff that you have that's written in unityscript for example. As it stands a lot of unities built in standard assets are written in js and I have lots of errors in my c# project because I use visual studio and it doesn't know about the various image effects and things
     
    Last edited: Oct 26, 2012
  18. projectionmatrix

    projectionmatrix

    Joined:
    Sep 9, 2012
    Posts:
    4
    kurt, you are about to make so much money.

    Will this have support for document outline (Like mono-develop does with #regions's)?

    Way to go man! Can't wait to get my hands on this!
     
  19. CorruptScanline

    CorruptScanline

    Joined:
    Mar 26, 2009
    Posts:
    217
    It should see completion data from all languages, because it uses Reflection as well as parsed data to resolve the completion item list.

    If I do implement an outliner it would probably be done as more of an API browser, like the object browser in mono develop and visual studio. It would use reflection, which (AFAIK) doesn't have any region info so it wouldn't group stuff by region. It definitely would be possible to have region grouping, but then you would be relying more on parsed data which means you need to have different solutions for each language, and I'm not sure if its worth the extra work. Something like this could be done in the future, or by someone else using the plugin system.


    I have almost completed the autocomplete stuff. The last major task is to get generics working. Currently it can resolve complex nested expressions and figure out the data from namespace, types, fields, properties, methods and indexers. If there are multiple overloads for a method or indexer it will resolve the arguments to find the types, and match those to the correct method or indexer in reflection and/or parsed data and get the resulting type. Heres a shot of it resolving an expression with multiple indexer choices.


    Hopefully I can use this same API to do code tooltips on mouse hover, and showing method overloads while typing.

    I have also been thinking about a debugging solution. Creating a stepping debugger in unity is a very strange task because it would be trying to debug itself. The solution I have in mind wouldn't be a true stepping debugger, but would show you the the same, or more info you would get from one. The difference is it would show you this data after the current frame has ended and/or stack the data up over multiple frames. You would add variable watches and it would show the data line by line next to the code in a sort of timeline with nodes containing info for the state right after each statement execution.
     
  20. CorruptScanline

    CorruptScanline

    Joined:
    Mar 26, 2009
    Posts:
    217
    Generics are now autocompleting correctly so pretty much everything should have correct autocompletion data. I'm sure there will be some small issues with certain syntax which can be fixed as they come up. I still want to add icons that indicate what the item represents (field, method, namespace, etc), and mouse over tooltips that show you info about the item your mouse is over.

    Heres some gifs of it in action.




    note that the delay in updating while typing is because its currently regenerating all the data every time something is changed. Updating will be nearly immediate when the items are cached.

    Its also showing both static and instance members all the time which will be fixed.
     
    Last edited: Nov 3, 2012
  21. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    Dayum! This would probably increase my productivity dramatically, especially in those instances where VS decides to throw a fit.
    Would this be a paid source distribution?
     
    PrimalCoder likes this.
  22. Quickfingers

    Quickfingers

    Joined:
    Aug 29, 2009
    Posts:
    268
    Hey Kurt just looking at your gifs and thought of something that might be cool as an option, one thing I notice I'm used to is bracket auto completion, so the close parentheses for square brackets, curlers and normal are automatically added when I type the open me. This should probably be a preference though as some people may not be used to it and might seem weird
     
  23. Lypheus

    Lypheus

    Joined:
    Apr 16, 2010
    Posts:
    664
    I'd tap that - keep this coming, looking great!
     
  24. CorruptScanline

    CorruptScanline

    Joined:
    Mar 26, 2009
    Posts:
    217
    I'm not sure if I will distribute the full source code with it, but the plugins such as find/replace will be included as source files, mainly to be used as reference if anyone wants to make their own plugins.

    Yeah I can have an option for auto closing brackets and stuff. I guess a good solution is have it on by default but also detect if the user types a "()" combination quickly and then just replace the automatically added ")" so its not an annoyance to people who dont want it but also dont bother to turn it off.

    Recently I have been working on a custom C# parser because of problems I had with an existing "fully featured" (but unfinished) library. The problem was that it would sometimes break on certain files and was finicky about incomplete code. The custom parser is currently doing almost everything I was using the library to do. Using a full C# parser is a little overkill anyway, as the data I actually need to parse is quite limited. I really only need namespaces, type declarations, members, local variables, and for, while, if, etc statements. This parser is separate from the code that resolves expressions for auto completion, and only exists to to provide data where reflection cant. I planned on doing this for unityscript anyway and porting it for unityscript should be fast, and most of the expression resolving code is language independent.
     
    Last edited: Nov 11, 2012
  25. CorruptScanline

    CorruptScanline

    Joined:
    Mar 26, 2009
    Posts:
    217
    Tooltips are almost done although it still needs to show method overloads while typing.


    Autocomplete is also pretty much done. It will now show you static or instance items depending on if the expression is static or instance.
     
  26. nicunity

    nicunity

    Joined:
    Feb 26, 2012
    Posts:
    52
    Will this work for unityscript and boo as well?
     
  27. marps

    marps

    Joined:
    Sep 8, 2012
    Posts:
    5
    Looks fantastic. I know you said no ReSharper type mechanisms, but one thing I would find useful is a "Find Usages" idea... and debugging. If you nail the debugging - I would easily pay the money for that. :)
     
  28. CorruptScanline

    CorruptScanline

    Joined:
    Mar 26, 2009
    Posts:
    217
    I plan to have Unityscript support for all of the advanced features. Boo will probably not have tooltips and smart autocomplete, at least initially. For Boo I will probably have a generic autocomplete that only looks at local file words and static known keywords.

    I will probably have a "Go to declaration" feature, although It will probably only work within the current file at first. I wrote some stuff about plans for a debugging feature on the last page.
     
  29. CorruptScanline

    CorruptScanline

    Joined:
    Mar 26, 2009
    Posts:
    217
    Find and replace is mostly done:

     
    Last edited: Nov 26, 2012
  30. LebrEf

    LebrEf

    Joined:
    May 21, 2010
    Posts:
    11
    Great work :)
     
  31. projectionmatrix

    projectionmatrix

    Joined:
    Sep 9, 2012
    Posts:
    4
    Think this might be out in time for christmas?
     
  32. CorruptScanline

    CorruptScanline

    Joined:
    Mar 26, 2009
    Posts:
    217
    Yes I hope so. The last couple tasks are:
    Make project view panel collapsible.
    Finish "Plugins" section in the settings menu.
    Make a plugin to search the unity docs for selected terms when you press a hotkey (probably F1).


    Since the last update I got a lot of things done, such as intellisense style auto complete for Unityscript, as well as C#, generic local file token based auto complete for all other files, method overloads tooltips while typing, settings menu, theme system, a search field in the project view window, an error tracking plugin, "go to declaration" feature, and customizable api token recognition (for colored highlighting) from desired assemblies. I also half implemented code folding but put it on hold for now.

    Visually not much has changed but heres a screenshot of how it currently looks:
     
  33. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    Is it possible to have Indentation-based folding, so each section can be closed down to focus only on the current part?
     
  34. CorruptScanline

    CorruptScanline

    Joined:
    Mar 26, 2009
    Posts:
    217
    Yes, the half implemented code folding currently uses parser info to decide whats foldable, but this is defined in the "syntax rules" class so different files types could have different rules for deciding where folding happens.

    I'm not sure if the first release will include code folding though.
     
  35. thienhaflash

    thienhaflash

    Joined:
    Jun 16, 2012
    Posts:
    513
    Looks extremely interesting, man ! Keep up the good work !
     
  36. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Looks great!

    Some features I love that exist in unity right now:

    1. double clicking in console on a debug log output will take you to the debug log statement in the code
    2. double clicking on an error in the console will take you to the offending line

    Do you support these little nice-to-haves ?

    Also another really nice to have thing would be "auto save on play" or just pressing play will save and build the code. Or just have it save under various little rules :)
     
  37. carmine

    carmine

    Joined:
    Jan 4, 2012
    Posts:
    394
    I absolutely want this. I'm on a mac.. mono develop takes a really long time to load up. Also.. it's really annoying to keep switching programs. Also... on my mac I can use full screen mode on programs. It would be great to just full screen myself in Unity and super focus on what I'm doing.

    When is this being released?
     
  38. n0mad

    n0mad

    Joined:
    Jan 27, 2009
    Posts:
    3,732
  39. Benjamindavid

    Benjamindavid

    Joined:
    Sep 25, 2012
    Posts:
    68
    WOW! looks awesome.. Integrated into unity3d? That would be so nice. I'm really interested in this..
     
  40. Benjamindavid

    Benjamindavid

    Joined:
    Sep 25, 2012
    Posts:
    68
    What language did you actually use to integrate it into unity3d? Just curious...
     
  41. CorruptScanline

    CorruptScanline

    Joined:
    Mar 26, 2009
    Posts:
    217
    Yep, as n0mad said this has been released, I forgot to update this thread:
    http://forum.unity3d.com/threads/164005-UnIDE-A-Code-Editor-Integrated-Into-Unity-RELEASED

    There is unity console integration. You cant double click on a console entry to open UnIDE, because afaik theres no callback stuff to handle this yet. But there is an error tracking feature which looks at the unity console to see the selected error/warning/log and then displays info about that in the text editor window with a button to go to where it happened, and highlights the line with a color representing the console entry type. Heres a screenshot of that:


    Its written in C#.
     
    Last edited: Dec 29, 2012
  42. roxIndie

    roxIndie

    Joined:
    Oct 14, 2012
    Posts:
    28
    Nice work! Having the code editor as a tab along side Scene and Game tabs gives a really nice workflow compared to switching windows (believe it or not). But I cant get the "Go to definition" to work. Would be nice if it acts as control + click in VS :)
     
  43. Robota

    Robota

    Joined:
    Feb 7, 2012
    Posts:
    82
    Hi Kurtloeffler,
    Unide is really promising. I use it with Unity 3.5.7.
    But for now, it is really slow on my mac book pro, too slow to work in good conditions.

    Also I got a really nasty bug, sometimes after editing my scripts and compiling them, I got this error :
    "Unexpected symbol `<internal>'"

    In this case I must re-edit the script with monodevelop to remove the "invisible" bad character.
    I can't wait for a new version! :)
     
    Last edited: Jan 15, 2013
  44. Lypheus

    Lypheus

    Joined:
    Apr 16, 2010
    Posts:
    664
    Two "big" asks for me, I'm almost at the point now where I can ditch mono/sublime2 and use this builtin ide, which is saying a lot:

    1. Need a "jump to class", something like MonoDevelops CTRL-ALT-T.
    2. Need a "search across all files", maybe CTRL-SHIFT-F.

    When those two are in place and with a bit more work on stability, this will feel like its always been part of the Unity3D workflow to me.

    BTW, I'm using http://www.fontsquirrel.com/fonts/Anonymous-Pro for my font with this, really makes for a nice user experience :).
     
  45. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hi again
    I wasnt but now I keep getting a null reference exception every frame :/

    NullReferenceException: Object reference not set to an instance of an object
    UIDE.Plugins.ErrorTracking.ErrorTracking.UpdateSelectedConsoleEntry () (at Assets/UnIDE/Editor/Plugins/ErrorTracking/ErrorTracking.cs:299)
    UIDE.Plugins.ErrorTracking.ErrorTracking.OnTextEditorUpdate () (at Assets/UnIDE/Editor/Plugins/ErrorTracking/ErrorTracking.cs:77)
    UIDETextEditor.Update ()
    UIDEEditor.Update ()
    UIDEEditorWindow.Update () (at Assets/UnIDE/Editor/EditorCore/UIDEEditorWindow.cs:180)
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Applications/buildAgent/work/b59ae78cff80e584/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Applications/buildAgent/work/b59ae78cff80e584/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Applications/buildAgent/work/b59ae78cff80e584/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/BuildAgent/work/7535de4ca26c26ac/Editor/Mono/GUI/DockArea.cs:234)
    UnityEditor.HostView.Invoke (System.String methodName) (at C:/BuildAgent/work/7535de4ca26c26ac/Editor/Mono/GUI/DockArea.cs:227)
    UnityEditor.HostView.SendUpdate () (at C:/BuildAgent/work/7535de4ca26c26ac/Editor/Mono/GUI/DockArea.cs:284)
    UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at C:/BuildAgent/work/7535de4ca26c26ac/Editor/MonoGenerated/Editor/EditorApplication.cs:210)


    Any clues on something?
     
  46. SurfaceTension

    SurfaceTension

    Joined:
    Jul 28, 2012
    Posts:
    20
    I tried firing up the trial version of UnIDE for the second time today (first time was about a week ago). I was a bit surprised when I got the activation prompt again, since I assumed a one-time activation would be enough. Anyway, upon clicking the "Activate trial period" button, I get an error message in the console, starting with this:

    "SecurityException: Unexpected error while trying to call method_GetSecurityPolicyBlocking : System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Net.WebException: The remote server returned an error: (404) Not Found."

    ...so I guess the server is down?
     
  47. Linus

    Linus

    Joined:
    Feb 22, 2012
    Posts:
    112
    Great, will pay for the full version.

    Been trying at least 4 different editors.

    But is there anyway I can make the code more colorful. I have edited USKeywords.cs and added some of my types. But words such as "case" still remains white/gray.

    Can extend to add more lists with another color?
     
  48. Evan Stallings

    Evan Stallings

    Joined:
    Jul 10, 2013
    Posts:
    40
    I just downloaded and tested the demo and I must say this is awesome. Very, very good work. I am definitely going to purchase the full version. Thanks for such a wonderful tool for Unity.