Quantcast
Viewing all articles
Browse latest Browse all 165

What to do with "unloaded" gameObjects?

I'm working on a small 2D project that has a character moving around in a grid of tiles in a top-down fashion. I'm using chunks to reduce the processing load because it freezes a lot when generating large worlds and it worked; I have set up those chunks (GameObjects with tiles as children) with their data about held tiles (GameObjects with a Sprite Renderer and attached script) and they are managed in Lists by a world manager. I understand how to load the chunks near the player and all, but my question is: When my character is somewhere in the game, and he has chunks loaded, what do I programmatically do with chunks that shouldn't be loaded anymore, for example the player moves away? They get removed my List of active chunks but where should I let them "go" to "unload" them. I was thinking of disabling the GameObject of that chunk, and re-enabling it when the player is near but other than that I have no idea. My goal here is to optimize performance and unload unused chunks with their data for my to be large game world. Maybe I'm missing something very important here but I just can't seem to wrap my head around a way of doing this.

Viewing all articles
Browse latest Browse all 165

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>