How multiple instances of a object are treated by Unity?


I have in my 3D Max file a Room with a lot of instances of the same objects (lots of desks, pcs, keyboards, mices). I exported the file to FBX and got it in Unity, but i think the FPS is a little too low, the same room withou the object was something like 400fps, and now i got 30-40fps, the objects are all low poly and i dont have illumination yet.

While studying UDK, i saw that the talk a lot about static shapes, where in the memory it has only one object, and you can use many times in your scene. So i wonder how this happens in Unity and the best way to optimize my scene.

What you need to do is to set common objects as prefabs in unity and then clone the prefab in the scene. This uses less memory then importing a single level model and is also much faster to render as it uses less memory and fewer draw calls and your level editors / designers don't need to open 3D Max to change the level, they can just place prefabs like lego blocks.

They said as much in the Unity 3 vertex snapping video. Creating levels in unity 3 will be easier with vertex snapping but at the moment you can use surface snapping and grid snapping by holding ctrl and using the grid snapping options.

As an added bonus you can then add components and scripts to a prefab to alter all objects on the scene of that type. Street lamps need light sources? Just change the prefab. Rocks too small? Import the model at a slightly higher scale.

You can try rolling your own occlusion culling or you can wait for Unity 3 to come out.

I believe the best way to go about that would be to create the "detail" objects separately, and then import them as meshes into Unity individually. You can then place them as separate objects, statically in the scene, and duplicate them, so multiple objects only reference the one mesh, increasing performance (since you're only drawing the same object multiple times, instead of drawing multiple copies of the same object).

Basically, Unity doesn't know that those props are duplicates of one another in your scene, since you did everything in 3DS Max. Unity just sees that as one big mesh, and it can't really optimize your duplicated props since it doesn't know that they're duplicates. However, if you make them duplicates within Unity itself, you should get some optimization.

Does that make sense?

mesh instantiation would be very usefull to reduce the file size... I got 200 trees in a scene and the file size is huge. Using instanciation would have stored a single mesh data and multiple transforms I hope Unity will support that one day