Batches, SetPass WAY High Until I Pause and Unpause in Editor

I have a scene that loads another additively. That scene instantiates a bunch of stuff into the first scene then sets itself as the Active scene. For some reason I’m seeing way higher batches and SetPass calls, which of course comes along with a big drop in FPS. However as soon as I press pause in the Editor the batches and setpass counts go back to where I expect. Unpause keeps them at the correct numbers too. Additionally, if I click around in the hierarchy a few times, it “fixes” the problem too!

Any ideas? I’m on 2019.4.29

Here’s a video showing what I mean:

First things first, check the profiler - compare it with before and after pausing.

Further to my original post, the problem is only resolved when hitting pause in the Editor while the player window is initially “maximize on play”, OR if not originally maximized when pausing and then “maximize on play” and resuming.

As an FYI I am using Addressables to do the scene additive load.

I’m almost always in the Profiler :slight_smile:

This image doesn’t show much beyond confirming that it’s not just the “Stats” window being wonky. But I did dig deep into the profiler and saw mostly what I expected to see with this problem. Parent processes being slow because the number of child processes are far greater. What I don’t understand is why there are so many more. It’s like all my batching and optimization efforts are non-existent on the left before hitting Editor’s pause, then suddenly are working on the right after Editor unpause.

What I didn’t expect to see was that RAM consumption was a lot greater before (8.26GB) hitting pause than after (6.57GB). Almost everything is more (see below) except Audio and Physics which both remain consistent. Of course, this is in the Editor so results may vary. But since the problem is always present in a build I can’t test effectively with the Memory Profiler or the regular Profiler.

7882969--1002937--batching-and-setpass-wonkiness2.png
If this were just an Editor issue, I could live with it. But as it is, the build always has the higher batches, setpass calls, lower FPS - it never returns to normal.

I’m supposed to be putting my game out for public beta next week so this is quite a problem for me, and I’ve been investigating for a few days now.

Any and all help is welcome!

EDIT: It’s not doing occlusion culling before pressing pause and IS doing it after. Seriously, WTF!

7882969--1002883--batching-and-setpass-wonkiness.png

You could try to use the frame debugger to see what is causing all the drawcalls.

1 Like

So it’s not doing the occlusion culling before hitting Pause and unpause. Here’s a video showing before and after. Watch for there to be many “buildings” before pause (not expected result), which are then gone after (expected result).

I’m really hoping someone knows what’s happening here.

Edit: In the video you can also see it says “No occlusion data has been baked” before pausing. I definitely have it baked in the scene being additively loaded.

Its wired that the Visualization inspector says that no data has been loaded / baked and after pausing its showing it.
Maybe Clearing and re-Baking the occlusion cache would help.

Agreed! I most recently re-baked less than 48 hours ago but I’m about to try that again.

Perhaps I’m just having a misunderstanding. Baked occlusion culling, to my knowledge, is never shared between scenes regardless if loading a scene standalone or loading one additively. It’s also my understanding that baking the occlusion culling can happen without the need to have all the scenes loaded at once - so I have been baking them separately. Do you happen know if my understandings correct?

It certainly feels like the 1st loading scene’s occlusion culling is being used (well, it doesn’t have any) even though the 2nd scene is the active scene (and does have it baked).

From what i can read in the Dokumentation all Scene that are expected to be loaded additive have to be baked together with the base scene where they are loaded from.

Oh my! This is why it’s good to bounce things off other people sometimes (I’m a solo dev).

I must have confused things in my head with lightmapping, reflection probes, light probes, or something. Thank you so much. I’m going to do this now and am confident it will solve my issue. Still makes one wonder why pause/unpause resolves it in the Editor but I’m less worried about the Editor than the actual build.

Will report back once done. :slight_smile:

1 Like

Problem solved! Thanks so much. I’m back to about 150fps instead of 60fps. :slight_smile: Obviously I mixed up the lighting documentation in my head with the occlusion documentation.

1 Like