Creating a Enemy Spawn / Despawn Mechanic to Improve Game Performance


During the last couple of weeks my team has been dealing with ongoing performance problems, so it was my job as the lead programmer to figure out a solution. I decided that implementing a despawn / spawn mechanic to set specific enemies to specific locations so not all of the enemies were in the scene at once. In the beginning of the game, all of the enemies are spawned in, and then turned off after they have grabbed their required components, and then when the player hits a collider they will spawn the next or previous enemies depending on their direction. This greatly improved performance, and also decreased the amount of objects updating in the scene. In the images I provided I show a snippet of how I use the toggle switches for the enemies.

Get R-BRT

Leave a comment

Log in with itch.io to leave a comment.