- Home /
Most optimized way of reusing the same structural models over and over again?
There is a big hotel in my game, with lots of identical bedrooms, and I'm not sure of the most optimized way of implementing it in Unity.
Should I model the entire hotel first with all the rooms and import that model one into Unity. Or should I model one room with all the items (bed, door, table etc) in it, and reuse that one model to replicate it for every room in the hotel.
Which is most efficient?
I am trying to create a 3D FPS game that works on mobile so I'm trying to keep the tri count down to an absolute minimum.
I'm not sure I fully understand static batching unfortunately.
Answer by AlwaysSunny · Apr 06, 2015 at 06:43 AM
Definitely avoid redundant duplicate meshes.
Replication is always better than duplication. I guess you could model the scene in your modeling application as you like, but use dummies / avatars or whatever your application calls them. In other words, model furniture, fixtures, etc only once and place references/dummies/avatars to those models throughout your creation using your 3D app. When you export, ensure those replications are exported as empties. Later you'll be able to tell unity to place replications (instances) of the models at those empties via scripting.
Or, you can model all props once, export them, and place them throughout the scene in Unity. Either way is equivalent, but the Unity scene editor is... clunky. I'd do the export-empties-and-place-instances route myself, even though it means some scripting work.
Thanks for the answer. I'm not sure I know the difference between replicate and duplicate?
Just to make sure I understand:
I should model the entire structure/building in my 3D application (Blender), then model each item of furniture separately in Blender and import them into Unity.
To reuse the assets over and over, can I drag one item into the scene, then duplicate that over and over. Or is there a replication function?
The gist is, you want to limit redundant information. If you have a 5 storey hotel with 20 identical suites, it would be silly to have 100 unique versions of that same identical suite. The file would be 100 times bigger, occupy 100 times more memory, etc.
I'm afraid I can't remember what Blender calls this concept. I remember shift-D duplicates, and alt-D replicates, but when Unity imports a blend file, I think there is no distinction between the two. But IIRC there is a concept in blender that will let you place empties that are tied to a model; the empty placeholder should be named based on what model it's tied to; SmallBedRoom, HighBackChairA, DeskLampB, etc. Then, using a script you write in Unity, you can instruct Unity to place an instance of the corresponding model at that location / rotation / scale.
OR, if you'd rather avoid that, you should build one SmallBedRoom, one HighBackChairA, etc, and arrange instances of them in Unity. The downside is, working with the Unity scene editor is clunky compared to working with Blender's.
"To reuse the assets over and over, can I drag one item into the scene, then duplicate that over and over."
The duplicate vs replicate distinction only matters while modeling. Once you are within Unity, there is no distinction between duplication / replication. As long as you have created just one SmallBedRoom mesh in Blender, you can have it in the Unity scene as many times as you like without creating "redundant" data, because you're then working with instances of that single object.
Looking into what blender calls this concept, I think it involves Linked Library Proxies. This is an intermediate blender concept; I'd be surprised if you've even heard of it unless you've encountered a similar need before. This is how I would approach your situation; build the scene in blender using proxies, and use scripting to tell unity to place instances at those proxy locations.
If you feel good about using Unity's scene editor to construct your level from the individual parts you create in blender, just do that ins$$anonymous$$d. It might be easier to someone else; I just find Unity's scene editor unpleasant enough to want to bypass it.
Thanks for all the helpful info; it's much appreciated! So I went ahead and modeled the interior of the whole building as one large mesh while keeping it as low poly as possible and I'm happy with the results. I managed cut down on polys in areas I wouldnt have been able to were i to do it all individually! "you can have it in the Unity scene as many times as you like without creating "redundant" data" Cool! I don't $$anonymous$$d Unity's scene editor so that is my preferred choice of method :) Also, is it much more efficient performancewise if I batch all the room items room by room? For example have all the bed1 + chair1 + toilet1 + sink1 all batched together, and do it separetely for each room? From what I've tried to understand this is the method used to reduce draw calls and increase performance? I guess the best way of actually checking what works is to constantly test it with all the different methods. I'm just trying to get it right from the start, which probably isnt the actual best way! Thanks again for you help :)
Your answer
![](https://koobas.hobune.stream/wayback/20220613192250im_/https://answers.unity.com/themes/thub/images/avi.jpg)