Archive for July, 2011

Unityception!, Load content created in unity from a build made with unity to Unity!

July 5 | 11

Problem we have:

We need a way to create and edit supermarkets as fast as possible with different products (more than 1500 kind of products) for marketing research and the created scenes need to be lightmaped and tweaked so they look as real as possible at the end.


1) Unity doesnt offer an “out of the box” solution for placing specific products on shelfs (and it would be weird to have it).

2) A simple unity project with all the products that reside on our asset database  for a single supermarket has is not feasible as load times will take a lot (projects of 10+GB) and we want to keep file sizes as small as possible.

3) After creating all the products and placing them in each shelf we need to lightmap the whole scene  and do some tweaks as our environment needs to be as realistic as possible.

4) our asset library is huge so we need to organize it and load only the needed assets in each project.


I came with a fairly easy solution and it was that I “Duplicated” our library. one made of asset bundles and the other made of unitypackages. The one that contained asset bundles was going to be used in an editor that we created and the use of this editor was solely for placing the products/shelfs in the world.

Now when we save the file it saves the address of each asset in a VCS system so we can easily with an editor script download all the packaged assets (this is where we use the unitypackages), import them and place them according to the positions/rotations the editor has.

So finally I ended with 3 Unity Projects, 1 DataBase for assetBundles and one VCS that contained the UnityPackages for importing them.

The unity Projects:

-Supermarket Editor: This project is the one that is in charge for creating and loading all the asset bundles contained in the database and placing them accordingly. it also manages all the logic of the shelfs like you cannot put a product in the floor (only in a shelf), etc.

Its also the one in charge of  creating proceduraly the floor and delimiting the supermarket by creating walls for it. In this project goes all the logic for restricting the user for placing products correctly and also goes all the logic for serializing the data that is going to be loaded after in the Unity Editor.

-SuperMarket Library Creator: This project is used for creating both an asset bundle and an Unity package for the library. The asset bundle is used by the SuperMarket editor and the unity package is used by the Supermarket Scene Loader for loading the created scene inside unity.

-SuperMarket Scene Loader: This is a simple editor script that loads the created scene in the Supermarket Editor into the unity editor for further tweaking like lightmapping, occlusion culling,etc.

So the idea of how this works is like this:

Now after all this is done, this is how it works. Checkout a video I made.