Monday, May 23, 2011

Unity editor - 3D geometry intersecting gizmo axis




Experimenting with idea of adding simple 3d axis lines (intersecting with scene geometry, to better visualize object's whereabouts in scene) dynamically to origin of any GameObject currently selected. The way I imagine it, it will run automatically on Unity startup and work in the background, without need to have custom EditorWindow displayed or manually attach scripts to GameObjects. Only requirement would be to put plugin scripts or dll in Asset folder.

For now, it works in sync with editor's Pivot/Center and Local/Global settings, positioning itself in same point as default gizmo.

Unity Forum thread: Unity editor - 3D geometry intersecting gizmo axis

Tuesday, May 10, 2011

MonoDevelop file templates for Unity C# scripts

UPDATE(June 12, 2011): Added installation location description for MAC.

UPDATE(June 11, 2011): Added FAQ and one question/answer at the end of post.

UPDATE(May 11, 2011): Some last minute errors sneaked in template settings so MonoDevelop didn't load addin. Fixed version (0.81) is at new download link.

Description:
As the title says, here are some file templates for Unity, written in C#. It is initial version, I'm new to Unity and I didn't use all functions in practice, so this is some kind of... newbie template set :) If you have suggestions on how to improve them, or better yet you make some useful templates, feel free to share.

Installation:

Win XP
To install templates, extract package to "\MonoDevelop\Addins" folder and restart MonoDevelop (if it is already running).

MAC
To install templates, extract templates package and copy extracted folder to "Contents\MacOS\lib\monodevelop\AddIns" in MonoDevelop application package. Restart MonoDevelop (if it is already running).



MonoDevelop
To check if templates successfully loaded, go to New File dialog:

Here you should have few templates under QQ\Unity\C#:

If for some reason addin didn't successfully load on startup, go to Add-in Manager:

And try to Disable and Enable add-in, forcing it to reload:

Download:
Download here. Version 0.81

Links:
Reference on creating MonoDevelop file templates:
Monodevelop: Howto add a WinForm project and file template
Writing an Add-In - MonoDevelop
Extension Tree Reference - MonoDevelop
Forum:
Unity Forum thread

FAQ:

Q:
I used your package to develop my own template system, but, the package don't come in file menu, even when I disable/enable it. what's the problem?

A:
I made some tests and here are some conclusions.

On restart of MonoDevelop, if your .addin.xml has some errors or is not well formed xml file, MonoDevelop will not load it (if it has a cached working version of previous .addin.xml it will load that one).

Using enable/disable will not reload .addin.xml, only .xft.xml files. So if you make changes in .addin.xml and want to see them, you should restart MonoDevelop.

To know if changed .addin.xml has errors, you could change its 'name' and if you don't see in Add-in Manager a new name, but an old one, you know it didn't load because of errors, so previous cached file was loaded.

If some of .xtf.xml files didn't load, you can see in Message Log that there was a problem (Menu: View->Pads->Message Log). You will not see .addin.xml errors in Message Log.

If you can't find out what could be wrong with your .addin.xml you can contact me by email on my blog.