SceneSwitcher: After multiple switches, the scene gets lag

Hi, I’m using Scene Switcher to switch between two scenes. After switching between these two scene for multiple times(say more than 10 times) the scene gets lagged exponentially. Please help us

Original Post on Discord

by user 1141289362336784394

Hi, could it be that you have components in your scene that are not cleaning themselves up properly in onDisable or onDestroy? E.g. creating resources or subscribing to events when they start / awake / enable but not unsubscribe when they get deleted?

This is just a guess without knowing much about your scene tho - but we have very asset heavy scenes being loaded / unloaded in e.g. https://app.songsofcultures.com without any problems

Can you share more about your scene / features being used / custom scripts ? And maybe a live link?

Shall i do the bug report so that it would help you know better?

by user 1141289362336784394

Scene Switcher setup

by user 1141289362336784394

Loading Scene

by user 1141289362336784394

Lobby Scene with only one Scene Initializer script

by user 1141289362336784394

export class SceneInitializer extends Behaviour {

start(): void {
OnSceneLoadComplete.onSceneLoaded();
}

}

by user 1141289362336784394

Main Scene

by user 1141289362336784394

Service Scene

by user 1141289362336784394

Please let me know if these screenshots helps.Thanks

by user 1141289362336784394

Bug report also submitted

by user 1141289362336784394

the scenes which are switching doesn’t contains any script except SceneInitializer. Please help me to find the issue. Thanks

by user 1141289362336784394

Hey @Yokesh Immersive :wave:

When you take a look at the console you can see that you’re running into a case we don’t fully support right now - MeshColliders being on objects with multiple submeshes. They aren’t removed from the scene properly when switching, so they end up existing multiple times.

The workaround for now is either removing the MeshCollider or splitting the object into multiple meshes with one material & mesh collider each.

The object in question is Store_Walls.

Let me know if you have any further questions :cactus:

Thanks a lot for pointing out this issue. I will check and revert back.:saluting_face:

by user 1141289362336784394

Its working perfectly now after removing the Meshcollider. Thank you🙌

by user 1141289362336784394