I am no Blender expert (not yet) and I started working with Unity3D just a few months ago. Setting up the work flow of importing 3D models created with Blender was a bit painful. So if you are about to start with Blender and Unity3D, this little checklist might be useful for you.
Setup for Importing .blend Files
You have to decide which way to go, using blend files directly or doing an .fbx export. Exporting to .fbx gives you more flexibility to decide which Blender objects to export and what components e.g. you don’t need an animation for a static object. Using .blend files let you work more quickly as Unity3D does the import automatically for you. Importer settings have to be adjusted in Unity3D and are persistent, which is more convenient.
I preferred the second variant and to get this running, a patch must be installed (at least in version 3.4.0f5) in Unity3D’s application directory (directory /Applications/Unity/Unity.app/Contents/Tools on OS-X). See the threads Blender 2.57 and Blender 2.59 at the Unity forum for more information. The download of the small Python script is copied from woodn’s post (first in Blender 2.59 thread at 04:25 PM). Further installation instructions can be found on page 1 of the thread posted by woodn. Thanks to all the people there, their valuable answers saved me a lot of time 🙂
Tips and Tricks for Beginners
All issues apply to using .blend files in Unity3D.
- Unity3D imports from all Blender layers. I didn’t find a way to hide specific objects yet, even disabling everything in outliner did not suppress import of dummy objects like camera center.
- If you define more than one object in Blender, all these objects will be imported and the game object in Unity3D will always consist of all model objects. Keeping your model objects in separate .blend files makes life easier (we will have a more detailed look at this in the next section)
- Unity3D stores FBX importer settings for each .blend separately in the corresponding prefab. Thus you can rely on that changes in the Blender model do not affect these settings. If lighting of your object looks odd, check that it contains a normal map or force the importer to calculate normals.
- Blender creates backup files (.blend1, …) by default that are ignored by Unity3D. Nevertheless they appear in your project assets if the folder you are working on in Blender is located there. Ignore them or do working with Blender outside the project’s Asset folder and copy your results to the target location afterwards
- If you are using Subversion you should set ignore patterns on these backup files:
- In the directory where your Blender files are stored type svn propedit svn:ignore .
- Add (if in vi editor just type i and CMD-V)
- Save (in vi ESC :w ENTER)
- You don’t need to apply modifiers to a Blender model when using it in Unity3D. The FBX importer does this automatically
- Modifiers with different settings for View and Render like Subdivision Surface will be imported with view settings:
- A simple textured material without UV mapping will be rendered fine in Blender but the imported object in Unity3D does not use the material at all. Although materials are created during import as expected and everything looks good, the game objects remain „unmaterialled“. I don’t know if it is a bug or a feature but I had a similar effect when working with a more complex Blender project linking other .blend files, what indicates a bug in Blender maybe. So I use UV mapping in Blender even for simple models to get them displayed correctly in Unity3D
- Sometimes objects are not scaled right on the first import and are displayed almost invisbly tiny. In this case you can adjust the scaling: Check FBXImporter / Meshes / Scale Factor and set the values from 0.01 to 1.
Organising Directory Structure
Dealing with several stand alone .blend file can be annoying because of messing up materials, no support for having more than one file open in Blender, redundant data … On the other hand keeping more than one object in one .blend file leads to other problems: Assuming that you have a stairs.blend containing StairsUp and StairsDown as different objects, all your Unity3D game object will contain both objects:
|2 Objects in Blender||One Combined Object in Unity3D|
If you don’t need the StairsDown you have to delete it which implies losing prefab connection.
That’s why I design my objects in a repository.blend and than create a StairsUp.blend and a StairsDown.blend only containing links to their corresponding objects in repository.blend. See Blender Manual how to use object links (doc refers to version 2.4x but there were no conceptual changes). Thus I just have to set it up once and can use all objects independently from each other.
Some hints for using this approach:
- repository.blend and all other .blend files pointing to it should stay in the same directory, because of material assignment. Maybe there is a way to put the repository outside of the Assets directory structure, but I didn’t find it yet.
- Changes to repository.blend won’t be automatically reflected in Unity as long as the time stamp of referring files did not change. You can:
- Load and save dependent .blend files – somewhat boring
- Execute a touch command in console – could lead to confusing file state of Subversion
- Select all affected files or directories in Unity3D project view and perform a re-import – preferred way
- Sometimes Blender does not refresh automatically its models if you change the underlying textures. If so you have to do a manual refresh at Texture / Image: