Sunday, June 23, 2013

How to import Sketchup Free models into Unity Free

Sometimes you need to get your 'Programmer Art' into Unity.  I recently tried out Sketchup for 3D modelling and found it an excellent tool to let me create some basic models for prototyping.  This method will allow you to import your own models, or models imported from Google 3D Warehouse.  If you dont use the paid version of Sketchuo,  you will need this free plugin.  If you don't want to register on that site, its in my Dropbox.  Put this file in your sketchup\plugins folder.



Lets get started:

First we need a Sketchup model.  Here is one I made earlier :).  Feel free to use it or make your own.  If you choose to make your own, I recommend using the Simple Metre template, as the scale will match Unity.  If you want pull something from the warehouse, go to Window > Components and use the search bar.

A churchy type thing


When you are ready to export your model:

Select File > OBJ Exporter
Give it a filename and select YES to convert all texture files to PNG.
This process will also optimise the model (remove duplicate vertices etc..)

To import the model into Unity:

Copy the .mtl,.obj and the model textures folder into your projects Asset folder.  Create a new folder or use an existing one, it doesn't matter as long as it is in the Assets folder.
Open your Unity project.  You will see the model and its associated files in the project window.
There will be a prefab ready for you to drag into your scene (or instantiate through code), with it's textures intact, including the UV mappings.

The same churchy thing in a Unity scene.