Running out of memory

Solved

I’m currently playing around with randomly generating voxel worlds and have it running pretty much the way i’m expecting it to run at this stage of development. I am generating chunks of meshes to keep the number of objects in the scene low


The problem I seem to be having is when I load a new chunk it doesn’t free up the memory that has already been used.
1352925--66771--$xdjeUH8.png
as for how I load the chunks i spawn a certain number of chunks when I first generate the map and then as I move and those chunks move out of range of the camera I move them to the other side of the grid and generate new meshes for them.

Is there something I should be doing to free up memory before I generate new meshes for the chunks?

Are you ever actually getting rid of the chunks that you’re moving to the other side of the grid? That said, you might want to check out Unity’s Understanding Automatic Memory Management[/b][/url]. It’s also worth mentioning that if you’re loading your assets from resources, they will stay in memory indefinitely unless you call Resources.UnloadUnusedAssets().

No i’m not getting rid of the chunks. I’m setting their position.x or position.z to a new position and then assigning a new mesh to those chunks.

That page you linked was very useful in helping me understand my problem but what solution would you recommend I use?

I figured out i was just stupid and was assigning a new mesh instead of just editing the old one.