UnityDevelop, An Editor for Unity JavaScript

Choosing a language for Unity development is a tricky thing.  There are a lot of great reasons to use C# (like its tool ecosystem), but other, just-as-great reasons to use JavaScript (like its less verbose and more accessible nature).  The Unity forums have endless debates about language choice.

The availability of Intellisense with Visual Studio is a huge reason to use C#.  However, we liked the simplicity of Unity’s JavaScript, its similarity to Flash’s ActionScript, and some of its automagical features like compiler support for yield.  Ultimately we decided to use UnityScript here at Flashbang, and modified FlashDevelop to provide an editor environment with code completion.  We use FlashDevelop for our Flash work already, so this made sense.


Watch this in HD!

We’ve been using this tool for over a year now, internally.  It’s still a hack–so your mileage may vary–but we’ve been quite happy with it!  It’s taken us awhile to scrounge together a release, but here it is:

Installing UnityDevelop

1) Get Windows.  UnityDevelop is a modified FlashDevelop.  Unfortunately, FlashDevelop is Windows-only, which means you’ll need to find some way to run Windows alongside your Mac (unless you’re using Unity 2.5 by now, in which case you’re probably golden)!  We recommend using Synergy to share a keyboard/mouse between both monitors, or virtualizing Windows entirely.

If you virtualize Windows, seriously look into a stripped-down version of XP.  You can use nLite to do this yourself, or you can download a pre-made ISO if you don’t mind dipping into the shadier areas of the Internet.  This will reduce the memory footprint of XP tremendously (the popularity of Netbooks means there are endless tutorials and pre-made variants available).  If you run multiple monitors, you probably don’t want to run the Coherence/Unity feature, which can be slow with a ton of desktop real estate.  We run Parallels in windowed mode.

2) Download UnityDevelop (2.9 MB).

3) You probably want the classes for Unity 2.6 (replace the files in your UnityDevelopClasses directory).

4) Unzip, and copy the UnityDevelop directory to “C:Program Files”.  There are some hard-coded paths in here; apologies if you organize your apps differently!

Creating a Project

UnityDevelop works best if you have your scripts in a single, scripts-only directory to begin with.  Open up UnityDevelop, and go to Project->Create Project.  We directly access our Unity project files via a network share; this is fine.

Select “Empty Project” as your template, give it a name, and browse to your scripts directory.  This will look like:

A “project” is just a pointer to a directory.  If you add new files in Unity, they will show up here.  If not, click the refresh icon in the “Project Explorer” pane, or, in a worst-case scenario, just restart UnityDevelop.  In general it’s easiest to make new files in UnityDevelop directly.  The same restrictions apply here, though–make sure you do all of your script renames in Unity itself (if you rename outside of Unity it’ll look like one file was deleted and the other freshly created).

Code Editing

Now, edit away!  You’ll get autocompletion for built-in Unity scripts, as well as your own files.

Hooray!

Tips, Tricks, and Questions

Changing the Font

Our default settings file uses Consolas, which is a great programming font.  If you want to change the font, close UnityDevelop, edit SettingsScintillaNET.xml, and restart.

Project-Wide Search

CTRL-I is the shortcut to find in project.  It populates the search terms with your selection–you can easily select something, hit CTRL-I, enter, and see results immediately.  Nice!

Goto Declaration

F4 will go to the declaration of a function.  You’ll end up in the intrinsic class files for anything Unity-specific.

Editing Into Two Directories

If you get crafty with symlinks you can edit into your “Scripts” directory and the “Editor” directory.  On your Mac, create an empty folder, and then create symlinks into your project folder for both.  Create the UnityDevelop project file in this new directory.  If none of this makes sense, don’t worry (Pro Tip:  Use a network share to access your Mac; this won’t work with VMWare/Parallels built-in sharing).

I Can’t It to Work.  Can You Help Me?

Honestly, no, we can’t.  Sorry!  It took us forever just to release this, and all we had to do was zip up some files and write this post.  We don’t have time to support it, so you’re kind of on your own.

I Added Some New Stuff.  Do You Guys Want It?

Yes please!  It would be awesome to see this grow.  Just drop us an email! FlashDevelop 3 is almost done, too, if someone wants to take a stab and making the same hacks.

Here is the source code, by the way.

This entry was posted in Tools and tagged , . Bookmark the permalink.

33 Responses to UnityDevelop, An Editor for Unity JavaScript

  1. Miguel de Icaza says:

    I looked into what it would take to get FlashDevelop on MacOS using Mono’s Windows.Forms, but the code has some 140 P/Invoke’s that call into Windows native functions.

    It might be a nice task for a summer internship though.

  2. wim wouters says:

    hmmm… ever tried unpacking a Mac zip file on a windows machine? Pff… all directories get overwritten by 0kb files.

    Any chance you could zip it on windows for easier deployment… don’t feel like handmaking all the directories an copying individual files.

    Thanks!

    w.

  3. Hanford says:

    yeah, I second the ZIP issue. I can’t unpack it drag/drop with Windows XP’s built-in Zip support.

    HOWEVER, using Windows XP’s “extract all files” option (far left) does work.

  4. ryan says:

    Wow missed this, thanks!

    FlashDevelop, based on SharpDevelop, is by far the best Flash / Flex /haXe IDE so it is really great to release this for Unity. I hope one day I or someone has the time to port to Mono even with the 140 pinvokes.

    I have been using FD without the intellisense/autocomplete but may have gotten around to it. It looks like it was built with an older FD maybe I will look into adding a project type like haXe has done.

    Thanks for putting this out there.

  5. ryan says:

    nm saw that it is based on FD2, may take a look at updating for FD3 source.

  6. John Grden says:

    Works great! using in VMWare with unity mode it’s not even an issue

  7. Thomas Wester says:

    Nice work! Why did you choose to re-package FlashDevelop. Did you think of releasing this as a plugin to FlashDevelop?

    -Thomas

  8. Matthew Wegner says:

    Thomas: We re-packaged FlashDevelop because it was a lot faster. Rather than create a proper UnityComplete plugin, I just made some quick-and-dirty changes to ASComplete. Same with core application changes–just did one-line hacks here and there rather than architect something proper.

    I recently made a bridge application that can be set as the editor on Unity in OSX, and passes on the file/line# to UnityDevelop to open. I’ll get that posted soon…

  9. This is pretty slick. I say we get a pool going to pay for that summer intern. I would pitch in. 😉

  10. Wenceslao says:

    Hey guys, the Unity IRC channel told me that this was one of the better solutions for editing scripts so I’m giving it a whirl! Looks good so far! Thanks for releasing it the indie community!

  11. Aaron says:

    This works really well, thanks!

    I was sort of bummed the unity editor didn’t tell me what I could do, and it really hampered my ability to learn by just trying stuff out. This is a great addition to that workflow.

    It works perfectly on my Windows Vista Business 64, I just needed to extract to Program Files (not the x86 directory) and it runs fine.

  12. Roger Clark says:

    Its not a perfect solution but you can partially enable the F1 context sensitive help in UnityDevelop by going into the Tools->Program settings and change
    ASCompletion.Documentation.HekpCommand to

    http://unity3d.com/support/documentation/ScriptReference/[email protected][email protected][email protected]

    I says its not perfect for 2 reasons.
    1. I couldn’t get it to work using the local help that is installed by the Windows version of Unity, because it didn’t like the file:// path
    2. It only seems to work on class names or datatypes and not member names (I’m not sure why that is)

    But its better than nothing.

    I guess if someone spent the time, they could fix the issue with it not putting the ?q etc when using file:// paths and probably work out why the help is only working on classnames etc.

  13. tatoforever says:

    Hi there,
    Great release, i wish Unity have some kind of editor with autocompletion and intellisense. :S
    Anyways, it dosent work with VMware fusion.
    It gives me an error:

    Its there any requirement to make UnityDevelop working fine on windows, like .net runtime framework or visual studio runtime?
    Tank for the help :)

  14. tatoforever says:

    Here is the error:
    The application failed to initialize properly (0xc0000135). Clickk OK to terminate the application.

  15. Scott McMillin says:

    Just tried to install on a fresh XP SP2 VMWare image and I receive the same error as tatoforever above.

  16. Andrew Nare says:

    I’ve found a way to unzip the file in Windows without worrying about the pesky 0kb files for anyone interested. Using 7zip I open the zip file and deleted the _MACOSX folder and the .DS_Store file (in the Unity Develop folder) After that I could unzip it fine without any errors.

    Thanks for this btw Flashbang! Very useful.

  17. Taran says:

    This is the best blog so far on unity.cannot wait for the next post and what is to come. Big thanks. Even though a lot of the code is above my head because I am new, your insight into the concepts of unity game making are really helping me so much.great stuff

  18. tatoforever says:

    Hey Scott, install .net runtime 1.1,2.0 with hotfixes.
    You will not get the error anymore :)
    But i still dont have autocompletion lol.

  19. tatoforever says:

    Ok i got it working OMMMMMMMM ffff GOODD tanks guys!
    You need two thing to get this working
    .Net runtime framework, 1.1 and 2.0.
    Extract UnityDevelop into PROGRAM FILES so so your desktop shortcuts points to:
    “C:Program FilesUnityDevelopUnityDevelop.exe”

  20. compositeredfox says:

    Wow, this is exactly what I was hoping existed and had no hope on finding it. Thank you!!

  21. Jeremiah says:

    This is great.. the only problem is that if the UnityDevleop editor is already open and I double-click a text file in the Unity project, I get an error message dialog: “Error while opening the server”.
    If I click the message dialog away, the UnityDevelop editor will open already. Is there anyway to enforce UnityDevelop to only open a single instance of the editor? (Is there a setting for this).

  22. Al Anselmo says:

    I just started playing with Unity and got recommended this UnityDevelop, which seems a great tool.

    I am having a problem with UnityDevelop showing “what to do next”, like when I type “Vector2(” in UniSciTE, it says “Vector2(float x, float y)”, but this is not happening in UD.

    Besides this, it’s working perfectly on Windows.

    Any tips?

  23. Al Anselmo says:

    @Jeremiah
    I got used to this issue. All you have to do is get used to use Unity just to quick read your scripts, while use UD for opening scripts and editing.

  24. halogenx says:

    regarding step 3, where did you get access to the classes for Unity 2.6?

  25. Shawn White says:

    @halogenx
    For UnityDevelop we just parsed the Unity Documentation and created the implicit classes from that information. You could also use Mono’s reflection to get all of the UnityEngine class information, though that doesn’t come with the nice function comments.

  26. moiremusic says:

    “4) Unzip, and copy the UnityDevelop directory to “C:Program Files”. There are some hard-coded paths in here; apologies if you organize your apps differently!”

    Hm. How would this work for Windows 7, where “C:Program Files” is reserved for 64-bit apps? x86 apps would need to go in “C:Program Files (x86)”.

  27. Wang says:

    I tried many programs and finally I decide to use UnityDevelop. Nice work!

    But I hope in the next update, please enlarge the hint popup(the yellow tip) cause usually it will not fully shown.

    And if possible, please add the function allow user to change the font and size. My text is pretty small i hope I can enlarge it.

    Thank you!!

  28. Chris says:

    Does anyone know how to get the new Unity 3 classes for UnityDevelop?

    Thank you so much for releasing UnityDevelop. I’m a amateur programmer and this makes learning less daunting. =)

  29. Marten says:

    Hello! Sorry to bump this old thing but I really wanted to say thanks for sharing this! It’s a really great IDE especially when you’re used to using FD.

    Also, I was looking into getting the classes for Unity 3 into UnityDevelop and I was wondering if you have any good tips when parsing the documentation? Or if you even have done this already and would like to share :)

  30. LouAudet says:

    Hi there all!

    I just wonder how safe it is to use unity 2.6 classes with unity 3.

    Any plans to provide a unity 3 classes package soon?

    Anyways thanks for the good work!

  31. tek says:

    can you publish the classes for 3.0 or was there no change ?

  32. Adam says:

    Really, really cool. Not sure why I haven’t discovered this before now. Anyway, cool resource. I’d love to see it updated for Unity 3 as well, and would certainly be willing to donate to help it happen.

  33. Mårten says:

    Hello! Just wanted to let you know that I’ve uploaded intrinsic classes for Unity 3.3, to use with UnityDevelop, on our blog. Check it out:

    http://www.piecesinteractive.se/blog/unitydevelop-classes-unity-33

Comments are closed.