Converting from Blender to Unity units is an important step when considering importing your assets into Unity 3D. Using the correct units will allow the scaling, lighting, physics and other Unity functions to work in correctly. One of the nice features that unity allows is snapping of assets together.
In this post I’ll show how to setup blender ready to export to Unity. Importing the asset into Unity and check that the units are correct and finally how to use the new assets and to snap them into place.
Unity units are in meters, scale 1 in Unity is equivalent to 1 meter in the real world. The default blender settings at 1 unit in size will import into unity at around 1cm. This might look ok if you zoom in, however lighting and the physics engine could have strange effects when you start to implement them.
So, lets get started and open up Blender.
- Located the Scene properties within Blender and set the “Units” to “Metric”. Then set the Scale to “0.01”.
- The default cube that is opened in Blender is of the scale 2cm x 2cm x 2cm now that we’ve changed the units, which we can now change to 1 meter. We can type in “1m” into the properties window, which will change the cubes dimensions. Press “N” on the keyboard to view the transforms properties window with the cube selected. Enter 1m x 1m x 1m in the dimensions section in the transform dialog.
You might notice some screen clipping when you zoom out on the cube now that we’ve changed these dimensions; shown in the top left where the grid is missing. This is because the clipping for the viewport is now set to 10 meters. We can change this by scrolling down within the same transform properties window and locating “View”. Expand the view toggle and locating “Clip”. We’ll need to adjust the end clip property to 100m to allow us to view the cube without clipping within the view.
- So, we’ve set the cube to be of dimensions 1m x 1m x 1m, however if we export this into Unity it still won’t look correct. This is because the scale of the object isn’t set to 1. In my instance the scale is set to 50 for x, y and z. To “Apply” the dimensions of the transform so that 1m is of scale 1, we’ll need to select the cube object. We’ll then need to open the Object menu, Select “Apply” and then “Rotation and Scale”.
We’ll now notice in the transform properties window that we’re set to scale 1 for all axis.
- Lets now make sure the transform is the centre of the Blender scene. We can adjust the position of the transform with the “Location” section in the transform properties window. Set the transform to 0 x, 0 y and 0 z
- We’re now ready to export into Unity. Click “File”, then “Export”, “FBX”. I usually make sure that I select “Select objects only” and only select the “Mesh” component that I want to export. These are my settings:
Save the file to a location you can remember so that we can import this into Unity.
- Open Unity and then import the model we’ve just creating into the project and then drag the model into the scene.
- Now Open the “Game Object” menu and select 3D object, Cube. This will inset a Unity cube of size 1m X x 1m Y and 1m Z. If everything has gone well you’ll see that the meshes are of the same size.
- You can snap the objects within Unity by holding down the command key on the mac or Ctrl key on Windows and move the position of the cube. This will allow snapping of these objects for easy placement within the scene. Snapping settings can be changed in the Unity properties to get the correct snapping for your needs.
I’ve taken this a little further and used for a demo scene 10meter X x 10meter Y tiles. With just a few tiles I’ve managed to create a mini city scene quickly by duplicating the tiles and snapping them quickly into place. I’ve also used the unity Standard assets for the character controller to run around the scene.
With the camera settings set to orthographic and some camera filter effects in the game view the effects you’ll quickly be able to get an idea of the benefits of using these units to develop games quickly using the Unity units.