What is the best way to hide and unhide lots of objects ingame?

I have a building with multiple floors in it and I wan’t to hide floors where player is not in. Currently I have one layer for each floor and I’m using camera’s culling mask to hide unused floors. I also modify layer collision matrix to get rid of unwanted physics interaction. Each floor includes LOTS of static objects(walls, floors), lights, npc’s and misc items for player to interact with and all of those objects are set to proper layer depending which floor they are in.

Everything works fine and only problem I’ve found is that I might run out of layers someday. I probably could use only two layers (active and non-active floor) and do my own kind of layer system.

Anyway just wanted to ask if anyone has done something similar and has some tips what is the best way to hide and unhide lots of objects realtime.

Unity has a built in feature for what you are describing. Take a look at Occlusion Culling in the manual.

There are also some Unity Store assets that implement custom culling features. Just search for “Occlusion Culling”.