I’m currently working on a project, where I am using a LevelBuilder script to build the chosen level. It reads a string from a file, interprets each substring as a level segment and attaches them next to one another. so far so good, the level builder is working great.
But when testing it more extensively and loading one level after another, after a few scene changes I notice uncontrolled behaviour, like not loading the level at all, or only loading it sometimes.
I took a snapshot of the heap, and i noticed a constant increase in the number of btVector3 objects that got created. I was wondering why the memory wasn’t released and assumed it was a mistake in my code. But I created a small sample project, just with a basic cube in both scenes. And after each scene transition, the number of bt-objects increased, even though I don’t keep any references of objects of the other scene.
Is this behaviour intended or a bug? Is there a way to release the memory manually? how can i avoid an overflow, if I have to load lots and lots of objects?
I have identified some leaks related to entities not being freed properly when using loadSceneHierarchy, indeed.
But need to pinpoint it further, as it is a bit complex and many things are noisy on memory along the way. So looking deeper into it.