Unity Tools
Our studio spent a good deal of time prototyping gameplay
and design ideas in Unity for a project that has now been shelved. While
I cannot show scripts from that project, contained here are a number of
generic editor scripts that I put together to simplify the process of
transitioning from Maya to Unity. Please note that these scripts have not
been tested with any version other than Unity 3.0 Pro.
UnityTools (code)
This creates a UI that allows the user to control various aspects of their
scene for interpretation by Unity's FBX converter/importer.
- The user can select objects and tag them to be ignored by Unity, which
is helpful for references, controls, non-bound joints, etc. that users
don't want to appear in Unity, but would be a hassle to repeatedly delete.
- The user can select objects and tag them to be collision objects
(sphere, capsule, box or mesh).
- The user can "send" the Maya file to Unity, which will copy
the Maya file and all associated textures into a Unity project directory.
This was especially useful as our studio was using Alienbrain for version
control, which is incompatible with Unity. This allowed the artitst to work
on Maya scenes with the full security of versioning, and then "build"
all necessary files for use in Unity.
FBXMayaExport (code)
This is the Unity MEL script that converts a Maya file to FBX. It has been
modified to prepare the file prior to export to facilitate the following niceties:
- Automatic material conversion from Maya to Unity - handles lambert,
blinn and phong, and selects the correct Unity shaders for transparency
and specularity. Once the shaders are modified in Unity to include
normal-maps, light-maps, etc. then subsequent conversions will use the
modified shader.
- Automatic light conversion from Maya to Unity - handles directional,
spot and point lights.
In order for the two above MEL scripts to function
properly, some UnityEditor scripts must be placed in an Editor folder
within the user's Unity project. These scripts are:
- ModelImportCollisions.cs (code)
- Converts GameObject nodes created with UnityTools.mel into collision objects.
- ModelImportLights.cs (code)
- Converts GameObject nodes created with FBXMayaExport into Unity Lights.
- ModelImportMaterials.cs (code)
- Converts GameObject nodes created with FBXMayaExport into Unity Shaders.
- ModelImportScrollingUVs.cs (code)
- Finds GameObject nodes with properties created with UnityTools and adds
scrolling UVs. This requires the
UVScroller.cs
script to also be placed somewhere in the Unity Project directory.
- ModelImportPrune.cs (code)
- Removes extra GameObject nodes that were created solely for automated import tools.
Back to Main