标题: unity3d扩展脚本编辑器-UnityDevelop, An Editor for Unity JavaScript [打印本页] 作者: 会飞的鱼 时间: 2011-12-15 13:56 标题: unity3d扩展脚本编辑器-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 f***ms 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.
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***n 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***n multiple monitors, you probably don’t want to***n the Coherence/Unity feature, which can be slow with a ton of desktop real estate. We***n 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 “Crogram 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.