Monday, 14 April 2014

Importing a Daz Character into Unity

We're using Daz3D 4.6 and Unity 4.2.2 (March 2014 Pro release for WiiU). We're also using iClone 5.5 with 3DExchange for animation, but this post is notes on exporting a Daz3D character and importing it direct into Unity and applying standard animations from Unity utilizing the in-built Mecanim animation engine.

You can get Daz3D for free from here:
Buy Michael 6 Pro Bundle in the Content Marketplace:
You can get the regular version of Unity here:
You can get iClone here:
And 3DExchange is here:

OK, so these notes start with Daz3D where you've created your character (we've used Michael 6 with Newport shoes, pants and sweater, blue eyes and MicahHairG2M).

Click "File > Export".

Choose a location for the exported model and name it (make sure the file type is "Autodesk FBX (*.fbx)".

Make sure the following items are selected (there have been no animations applied to the model in this case, but if there are then make sure that "Animations" is selected):

  • Figures
  • Props
  • Morphs
  • Embed Textures
  • Merge Clothing into Figure Skeleton
  • Allow Degraded Skinning
  • Allow Degraded Scaling

Then click "Accept".

Note: Make sure that "Convert Clothing to Static Geometry" is NOT selected. This option was selected by default in my installation. If this option is selected and you animate the model, then only the Michael (or whichever model you are using) character moves; the clothes stay exactly where they were when you exported them. This results in some very amusing, if not frustrating, problems.

You'll see a progress bar as the model is exported. The bar disappears when the export is complete.

Now go to Unity and go to the "Project" view. I have a folder called "Models" (or Model for some odd reason in this screenshot!) where I store all the models I import just to keep everything neat.

Open an Explorer Window, browse to the location the model was exported to, and then just drag and drop the FBX file into the Model folder in Unity. You will see a progress bar in Unity while it imports your model.

Don't worry if you see anything like this message:

It's just Unity warning you that it found too many meshes and has corrected the issue for you. Unity is awesome like that.

OK, so now the model is in the "Models" folder, but DON'T ADD IT YET! You have to edit the model first so that Unity knows how to treat it. I keep forgetting about this, then wonder why my models do crazy things when I apply Mecanim (like sink half way through the floor, or move 5 miles away in game space, or go into some bizarre bear-hug-like pose, etc., etc.). Anyway, enough of "helping you learn via my mistakes". :)

Click on the new model and then look at your "Inspector". You should see 3 buttons/tabs:

  1. Model
  2. Rig
  3. Animation

Click on "Rig" (you should be there already) and click on the drop-down list next to "Animation Type" and select "Humanoid" instead of "Generic".

Click "Apply".

You can click on the "Configure" button and make sure that the bones all line up (right thumb maps to right thumb, left leg maps to left leg, etc.) but the Daz3D models export so well that you won't need to do that.

If your character had no animations, or you chose not to export them from Daz3D, then click on the "Animations" tab and clear the check mark for "Import Animation" and click "Apply".

You'll see the "Hold On" status bar for a minute, so let Unity do its thing. Once the status bar goes away, you can add your model to your Unity Scene simply by dragging and dropping from the Project window into the Scene window.

I have a folder called "Controllers" that I put my Animation Controllers in. I created an Animation Controller called "Michael6_6" and it only contains an "Idle" state which maps to the "Idles" animation from the Unity 4 Macanim tutorial (the tutorial is here:, and the assets (which include the animations) can be downloaded from here:

Click on the instance of your model in the "Hierarchy" pane, then drag and drop the controller into the "Controller" slot of your model.

Now hit "Play" to test and you should see your character run through the Idles animation.

My scene is badly lit as I'm testing some light effects, so don't be put off by how my model looks in this screenshot. Here is our character again and he's in a brand new scene with only a floor plane and a directional light and you can see how much better he looks (also, the FPS is a lot higher).

So there you go, that's how to add a Daz3D character to Unity and use the Mecanim functionality (in Unity 4.x) to apply animation.

Friday, 3 January 2014

Setting Photoshop as the Default Image Editor in Unity

You could use these steps to set any default image editor in Unity, you'd just have to change the file path.

Open Unity and click "Edit > Preferences" and then click on "External Tools". Click on the drop-down list next to "Image application" (labelled "Open by file extension" by default) and click "Browse".

Browse to where you installed Photoshop (it should be in the "Program Files" folder, I installed it onto my D Drive so the path is "D:\Program Files\Adobe Photoshop CC (64 Bit)") and select "Photoshop.exe" and click "Open".

"Adobe Photoshop CC" will now show in the "Image application" drop-down.

Close the Preferences window and now all image files will open in Photoshop.

Setting Visual Studio 2013 as the Default Editor for Unity

With our registration to BizSpark now complete it was time to take advantage of getting Visual Studio 2013 Ultimate for free and use it for the editor instead of MonoDevelop. I find that the autocomplete function in MonoDevelop doesn't always work as well as expected, so using VS may be better.

This integration opens scripts in Visual Studio, if you want better integration than that, then you want to look at UnityVS. If you're an Indie with 4 or less employees, then UnityVS is just $99. You can find out about their pricing here.

Open up Unity and click "Edit > Preferences" and then click on "External Tools".

Click on the drop-down list next to "External Script Editor" (it shows "MonoDevelop (built-in)" by default) and select "Browse". Visual Studio is an x86 application, so it will be in your "Program Files (x86)" if you are using a 64bit OS, or just "Program Files" if you're using a 32-bit OS.  I installed Visual Studio on my D Drive (on a machine running Windows 8.1 64-bit), so the path to it is:

D:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE

Select the "Application" "devenv.exe" and click "Open".The drop-down list will now show as "Microsoft Visual Studio 2013" so close the Preferences window and the next time you open a script in Unity, then it will open in Visual Studio 2013.