Import Blender models into Unity
During our Ludum Dare 41 Game Jam we had to create all our 3D assets in Blender. It was a long time since the last time any of us had to do any work in Blender, so we were a bit rusty. And as such we ended up struggling just getting the imports to be correct. So this is a note to self for the next time around we need to import our 3D assets from Blender into Unity.
Blender 2.79 from https://www.blender.org
Unity 2018.1 from https://www.unity3d.com
Creating the 3D asset
Start up Blender and open a new file. If you have the standard setup just delete the cube (X) while in Object Mode.
Make sure the 3D cursor is at the center (SHIFT+S) and select Cursor To Center.
Next we will add an empty that will be the parent of our mesh. This is a good practice in Unity. Add an empty by pressing SHIFT+A and select Empty->Plain Axes.
Change the name of the empty to better illustrate your asset.
Now we will add the mesh to the scene. While the 3D cursor is at the center, press SHIFT+A and select a suitable base Mesh.
Rename the mesh to something meaningful and make the empty the parent of the mesh. You can do this in several ways, but the easiest is to click the mesh icon in the Outliner and drag it over the empty icon.
Before we do some fancy modelling we need to put the base of the mesh on z = 0. Since our cube was 2 units in each direction, then we need to move it up 1 unit. The easiest is to press G (Grab), then Z (direction) and then 1 (unit). This will translate the cube up one unit.
Now for the important part! As we can see from the Transform values above the Location is off, we want it to be zero on all values. In Blender we fix this by Applying the Location, press CTRL+A and select Location. Then we see that Location is at 0,0,0.
Now we can enter Edit mode and create whatever we want.
Remember to save your file.
Start by selecting both the empty and the mesh in the Outline, do this by holding down SHIFT while clicking both the icons.
Then select File->Export->FBX.
Then make sure you select “Selected Objects” and “!EXPERIMENTAL! Apply Transform”.
Save the fbx file and you can import it into unity.
Open Unity and drag the fbx file into the Assets folder. If you added some materials they will be imported as well (Leaves and Trunk in the image below).
When you add the Model to the scene you will get the exact same structure in the Unity Hierarchy as in the Blender Outline.
Having the empty at origin (0,0,0) when exporting from Blender will make it a lot more easy to work with in Unity. You can basically just drag and drop the model into the scene and it will be placed just as you want. The model will also have a scaling of 1, so that one unit in Blender equals one unit in Unity. This is great when you want to design different models that has some relation to each other.
We hope you enjoyed this little guide, leave a comment if you want! Thanks for your time!