SketchUp, 3D Warehouse and Unity

Screen Shot 2013-07-04 at 16.40.23

As I wrote earlier this month, I’m now working on a Unity-powered version of ANGELINA. One of the common themes in the silly things I’ve coded up, as well as a lot of other computationally creative systems, is their ability to use information and media from the web in the content they create. We see this in human creativity too, and it’s a good way to add both scope to the project (because there’s a lot more for ANGELINA to use) and creativity to the system (because breadth can lead to more interesting creative decisions). Before I had even fired up Unity, I knew I wanted one thing above all else in this version of ANGELINA – the 3D Warehouse, a huge collection of 3D models made in Google Sketchup. Unfortunately, it’s not trivial to get Sketchup models integrated into Unity, particularly automatically. Here’s a rough guide to my current hacked solution.

1. Scrape the search pages for Collada files

Here’s some C# code for doing that. Sketchup offers several formats but Collada is the one that is easiest to convert to something Unity vaguely understands. The only important thing is that you add in the search URL:


This way you only get Collada files (zipped up) back. Mac’s default unzip feature didn’t actually work on these files, but this sort of function should unzip the folder no problem (Mac only, of course, but this kind of thing is quite easy to find via Google).

2. Use Autodesk’s cmd feature to convert the Collada .dae file to .fbx

I know nothing about 3D modelling but I do know that Unity supports .fbx files. Autodesk has a free FBX converter that takes in lots of different file formats, including .dae files, and works from the command line. Grab it from here. Calling it is a simple process very similar to the unzip example above, once you’ve found where the damn thing actually is. Mine was located several hundred nested layers into my hard drive at:

/Applications/Autodesk/FBX Converter/2013.3/

The actual .dae files are in a folder called models in the zip file we just opened. Point the FbxConverter at them and it’ll produce a .fbx file ready to import into Unity.

3. Using .fbx files in Unity

I’ve not done much with these models yet so this may yet explode in my face. But for now, you can do something like the following:

GameObject model = (GameObject) AssetDatabase.LoadAssetAtPath("Assets/Resources/model/robot.fbx", typeof(GameObject));

And you end up with a 3D model in your Unity scene. It has no colliders or anything like that, but a model’s a model. Let me know how you get on. I’m going to be trying to use these models myself in the coming weeks, so I may amend this post if there’s more work to do!

Leave a Reply