Lagging game in editor and in EXE although the computer is fine

Hi everyone. We are 2 person indie game developers and beginners to unity. We are trying to create a corridor with rooms on both sides. As level designer, i created the room contents in blender (desk, bed, wardrobe) and an empty room with just walls. I imported the empty room into unity then added the room contents. Then i copied the room and the contents multiple times to make a corridor. The problem is when there is a single room (with all interiors) there is no lagging but when i start to copy the rooms, the lagging beggins and eventually with 13 rooms in hand it lags like hell both in editor and when i play the game. I must add that the objects and the room are real life-sized. I also thought about if the textures could lag the game since its a 4k texture and i tried the game with no single textures (there is just 1 texture anyway) but it didn’t help, still lags like hell.

My pc specs are:

  • Nvidia GTX 965m
  • Intel i7 4720hq

I don’t think the game should lag on these specs. We haven’t done anything yet.

The other problem is the exe i took is not lagging just on my pc but my friend’s pc too which has GTX 2070. Shouldn’t his pc run the game smoothly?

How can we fix this lagging?

Here’s a photo of the corridor

Thanks in advance.

Check what the profiler says is the source of the lag. It is hard to say just looking at the picture.

The source is rendering. The peaks are when i start to walk across the corridor and looking to the corridor side from inside the room. Lower parts are when i’m inside the room and looking through the window side. What does this mean? How can we deal with this intense rendering?5398188--547749--Ekran Alınastısı.PNG

How many batches is it rendering at its max? You may have too many objects with unique materials/textures being rendered at the same time.

Look into batching them, and/or using Occlusion Culling to only render a portion of the scene at once.

1 Like