How to Export Game Assets From Blender to Unity 5

 

Here are 3 ways how to Export Game Assets From Blender to Unity 5. You can export your 3d models from Blender in .obj and .fbx formats, and import them into Unity. Or you can import the whole Blender project .blend file to your Unity project.

In this tutorial, you’ll discover how to:

 

.OBJ File

 

.FBX File

 

.BLEND File

 

The Conclusion

Prepare Your Game Asset Inside Blender

Select the mesh and give it a Name. Always name your meshes inside Object and Data tabs!

With your mesh selected press N to open the right side panel and at the top you should see Location, Rotation, and Scale settings.

Make sure that your settings are like this:

  • Location x,y,z = 0
  • Rotation x,y,z = 0
  • Scale x,y,z = 1

If  Not, do this! With your mesh selected press ALT+G to Reset mesh Location. Press CTRL+A and select Rotation & Scale to Reset Rotation and Scale.


Export Blender Model as .OBJ

With your mesh selected, go to File > Export > Wavefront (.obj)

Select location where you want to export and give the same name to the mesh as you named it in Object and Data tabs (Optional for consistency).

Now you need to change some Export OBJ settings which you can see on the left side panel (Default settings):

Enable Selection Only to export only selected mesh/es (if you leave it Disabled – All meshes in your Blender file will be exported as .obj file!). Disable Write Materials – Unity doesn‘t support .mtl files so we don‘t need it. Disable Objects as OBJ Objects and Enable Objects as OBJ Groups – this way Unity will use our mesh name we wrote in Blender instead of naming it ‚default‘. Enable Keep Vertex Order. Look at settings in the image below:


Import .OBJ to Unity 5

Choose one method to import your Asset into Unity:

  1. You can simply drag and drop your .obj file to Unity Project tab, to any folder you like.

 

  1. You can also Right Click inside Project window and select Import New Asset… locate your .obj file and press Import.

 

  1. A third method to import new assets by going to Assets > Import New Assets… (at the top left menu).

After you imported your Asset to Unity, you will see .obj file and a folder Materials.

Inside that folder, you will find the Material which is used by your Imported Mesh. (No matter if the Mesh has a Material attached inside Blender or not, after importing .obj to Unity, it will automatically create 1 new Material named (‚Mesh Name‘ + ‚Mat‘ suffix)).

Select your Imported Mesh and on the right side panel tab called Inspector, you will see a bunch of settings of that mesh. You can leave everything by default.

If you will bake Lightmaps for your mesh, Enable Generate Lightmap UVs only if your mesh doesn’t have a good UVs for lightmap baking, for example overlapping  UVs are BAD! Unity will use UV1(used for Baked GI) or UV2(used for Realtime GI) for lightmaps if the channel is present. Otherwise, it will use primary UVs(UV0). Unity can unwrap your mesh for you to generate lightmap UVs. Just use the Generate Lightmap UVs setting for that. (My Box Mesh I’ve used, has UV1 map created ready for lightmap baking, so I don’t need to Enable Generate Lightmap UVs).

Now drag and drop your asset to the Hierarchy (to the Scene).

You will see that your Asset is a Parent GameObject with Transform component attached.

And that Parent GameObject has a Child GameObject, which is the Mesh itself (with Transform, Mesh, Mesh Renderer, and Material components attached).

If you want to Scale, Move, or Rotate your Asset, select that Parent GameObject and change Transform settings of that (or use Transform Tools)!

I highly recommend you to Leave Default Transform Settings of a Child GameObject (the Mesh itself)! This way can be very useful to change your Mesh Scale, Position, and Rotation using a script or animating your mesh in Unity.

Apply Textures to Your .OBJ Mesh

1. Select a Child GameObject and open attached Material Settings. Here you can change the Settings of the Material attached to your Asset, change Color, add Texture Maps, etc.

 

2. You can also locate the Material Settings by clicking on the Material attached to your Asset, inside Project tab.

 

1. If you want to attach a Texture to your Asset, locate your Texture in the Project tab, drag and drop the Texture on the texture slot you want to add. For example drag and drop simple Albedo color texture on the Albedo slot:

 

2. You can also Attach the Texture by pressing on the little Circle Icon near Albedo slot and choosing your Texture Map:


PROS and CONS Using .OBJ file

PROS

  •  No unnecessary data exported.
  • Lowes file size.

 

CONS

  • Mesh can have only 1 material;
  • No matter if the Mesh has a Material attached inside Blender or not, after importing .obj to Unity it will automatically create 1 new Material named (Mesh Name + ‚Mat‘ suffix).
  • .OBJ Meshes must be re-exported manually if changes are made to the original file (in Blender for example).
  • Animation not supported.

Export Blender Model as .FBX

With your mesh selected go to File > Export > FBX (.fbx)

Select location where you want to Export and give the same name to the Mesh as you named it in Object and Data tabs.

Now you need to change some Export FBX settings which you can see on the left side panel (Default settings):

Enable Selected Objects to export only selected mesh/es (if you leave it Disabled – All meshes in your Blender file will be exported as one .fbx file!). Enable !EXPERIMENTAL! Apply Transform to avoid unwanted rotations to object/s.  Keep in mind that Blender says this about !EXPERIMENTAL! Apply Transform – „WARNING! Experimental option, use at own risks known broken with armatures/animations“. I’ve tested this setting with meshes without Armatures and Animations, works perfectly to me in any case. Look at the Final Settings in the image below:


Import .FBX to Unity 5

-If your Asset uses a Texture/s inside Blender, you should import those Textures into Unity first. So after you import your Asset to Unity, Texture/s will be applied to the Material on your Mesh automatically!

Choose one method to import your asset into Unity:

  1. You can simply drag and drop your .fbx file to Unity Project tab, to any folder you like.

 

  1. Or you can Right Click inside Project window and select Import New Asset… locate your .fbx file and press Import.

 

  1. A third method to import new Assets by going to Assets > Import New Assets… (at the top menu).

After you have imported your Asset to Unity, you will see .fbx file and a folder Materials.

Inside that folder, you will find Material/s which are assigned to your imported Mesh (.fbx files can use more than one material attached to your mesh!). Unlike .obj file, .fbx uses the same Materials with the same Names and Color Data which you are assigned in Blender. If your Material inside Blender uses the Texture, imported Asset Material will be called the same as that Texture!

Select your imported mesh and on the right side panel tab called Inspector, you will see a bunch of settings of that mesh. You can leave everything by default.

Also, if you have imported a Texture which was used in Blender for that Mesh, you should see that the Texture is already applied to the Material of that Mesh.

If you will bake Lightmaps for your mesh, Enable Generate Lightmap UVs only if your mesh doesn’t have a good UVs for lightmap baking, for example overlapping  UVs are BAD! Unity will use UV1(used for Baked GI) or UV2(used for Realtime GI) for lightmaps if the channel is present. Otherwise, it will use primary UVs(UV0). Unity can unwrap your mesh for you to generate lightmap UVs. Just use the Generate Lightmap UVs setting.

Now drag and drop your asset to the Hierarchy (to the Scene).

If you want to Scale, Move, or Rotate your Asset, simply select it inside Hierarchy and change Transform settings how you want (or use Transform Tools). Unlike .obj file, .fbx doesn‘t have a Child GameObject attached as a mesh.


Apply Textures to Your .FBX Mesh

1. Select your Asset and open attached Material Settings. Here you can change the Settings of the Material attached to your Asset, change Color, add Texture Maps, etc.

 

2. You can also locate Material Setting by clicking on the Material inside Project tab.

 

1. If you want to attach a Texture to your Asset, locate your Texture in the Project tab, drag and drop the Texture on the texture slot you want to add. For example drag and drop simple Albedo color Texture on the Albedo slot:

 

2. You can also Attach the Texture by pressing on the little Circle Icon near Albedo slot and choosing your Texture Map:


PROS and CONS Using .FBX file

PROS

  • Mesh can use more than one material.
  • Can export animated assets with bones and animation data.
  • Textures linked to the Material. So if you import a Texture and after that, you import a Mesh, Textures will be applied to the Material of that Mesh.

 

CONS

  • .FBX Meshes must be re-exported manually if changes are made to the original file (in Blender for example).
  • Takes up more space than .OBJ files.

Prepare a .blend (Blender project file)

Open the Blender and clean up your scene, delete everything you don‘t need to export to Unity and leave only your Game Asset with Materials, and Textures attached. Save it!


Import .blend (Blender project file) to Unity 5

Choose one method to import your asset into Unity:

  1. You can simply drag and drop your .blend file to Unity Project tab, to any folder you like.

 

  1. Or you can Right Click inside Project window and select Import New Asset… locate your .blend file and press Import.

 

  1. A third method to import new assets by going to Assets > Import New Assets… (at the top menu).

After you have imported your Asset to Unity, you will see .blend file and a folder Materials. (Unity converts .blend file to .fbx in the background, so everything is basically the same as importing .fbx file!)

Inside that folder, you will find Material/s which are assigned to your imported mesh. It uses the same Materials with the same Names and Color Data which you are assigned inside Blender. (.blend (.fbx) files can use more than one material attached to your mesh!). If your Material inside Blender uses the Texture, imported Asset Material will be called the same as that Texture!

Select your imported mesh and on the right side panel tab called Inspector, you will see a bunch of settings of that mesh. You can leave everything by default here.

If you will bake Lightmaps for your mesh, Enable Generate Lightmap UVs only if your mesh doesn’t have a good UVs for lightmap baking, for example overlapping  UVs are BAD! Unity will use UV1(used for Baked GI) or UV2(used for Realtime GI) for lightmaps if the channel is present. Otherwise, it will use primary UVs(UV0). Unity can unwrap your mesh for you to generate lightmap UVs. Just use the Generate Lightmap UVs setting.

Inside Inspector Tab go to Rig and set Animation Type to None. (This way after importing our Asset to the Hierarchy (to the Scene) Asset GameObject will no longer have an Animator component attached).

Now drag and drop your Asset to the Hierarchy (to the Scene).

If you want to Scale, Move, or Rotate your Asset, simply select it inside Hierarchy and change Transform settings how you want. Unlike .obj file, .blend(.fbx) doesn‘t have a Child GameObject attached as a mesh. Also, look at Transform Tab – Rotation is set to -90 by X-axis, and if you set it to 0, your Asset will be flipped on the side (.blend file is converted to .fbx in the background, so it works the same as we export .fbx file from Blender using Default Export Settings. We can deal with this rotation problem by adding an extra parent transform.


Apply Textures to Your .blend Mesh

1. Select your Asset and open attached Material Settings. Here you can change the Settings of the Material attached to your Asset, change Color, add Texture Maps, etc.

 

2. You can also locate Material Setting by clicking on the Material inside Project tab.

 

1. If you want to attach a Texture to your Asset, locate your Texture in the Project tab, drag and drop the Texture on the texture slot you want to add. For example drag and drop simple Albedo color Texture on the Albedo slot:

 

2. You can also Attach the Texture by pressing on the little Circle Icon near Albedo slot and choosing your Texture Map:


PROS and CONS Using .blend file

PROS

  • You can open and edit a .blend file which you have imported to Unity without closing Unity engine. This way you can make fast changes inside Blender and test them very fast.
  • Mesh can use more than one material.
  • Can export animated assets with bones and animation data.
  • Textures linked to the Material. So if you import a Texture and after that, you import a Mesh(.blend file), Textures will be applied to the Material of that Mesh.

 

CONS

  • Takes up more space than .OBJ and .FBX files.
  • Can contain a lot of unnecessary data.

In Conclusion

  • If you want to export 3d models with one material attached, and without animations, a good choice would be .obj file, it also uses less space than .fbx, and comes with parent and child GameObjects attached. But for the fastest and the best experience with linked textures and materials would be the best to export as .fbx file. (It’s up to you and you workflow).
  • If you want to export models with more than one material attached, or with animations, use .fbx file!
  • Use .blend file if you want to test, and make fast changes for your mesh. Don’t use .blend for the final project/game!

 

Thank you for your time, and I hope that this in-depth tutorial helped you to use your Game Assets inside Unity 5! 🙂

If you have any questions, feel free to ask in the comments below!

  • Follow me on Twitter to see what I’m working on. I try to post here something every day 🙂
  • Follow me on my Instagram 
  • Also, check out my Facebook 

Pin It on Pinterest