Featured Blog

Handling Bullet Holes in Unity

A short post about maintaining regularly spawned GameObjects in Unity5.

This was originally published on Our team is working on a FPS designed for short play sessions.

In the current project we are working on (Dawnbreak) we are intending to target a large range of platforms on release. This is primarily to gain experience on these platforms, and to maximise our player base.

Designing a game that can handle different platforms requires some thought to be how we handle textures in game. Our game requires guns and guns create bullet holes. Each of these bullet holes is a small texture painted on to the environment at run time. Over time, all those bullet holes add up to a huge amount of memory for something that really only added a moment of impact.

To solve this I created  Object Manager that cleans up and removes bullet holes when too many get created, allowing for players to continue to have an impact on the environment while not sacrificing too many resources.

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class ObjectManagement : MonoBehaviour {

    public int MaxNumberOfObjects = 100;
    List< GameObject> ObjectList = new List< GameObject>();

    void ManageObjects()
        if(ObjectList.Count > MaxNumberOfObjects)
            GameObject tempObj = ObjectList[0];
            Destroy (tempObj);

    public void AddObject(GameObject _object)

The manager is inherently simple to implement and use. A developer can set the maximum number of objects in the editor or set this in run time as a way to gain resources if a game gets too heavy. Call


and pass the GameObject wishing to be managed as a parameter. An easy way to manage anything in your scene that gets spawned with regularity!

Liam Simmons ~Software Engineer at Mutiny Productions. Check us out on Twitter @MutinyProds

Any advice/criticisms most definately welcome!

Latest Jobs

Xbox Game Studios

Redmond, Washington
Technical Lighting Artist


Hamburg, Germany
Game Designer - Elvenar

Six Foot

Houston, TX
Six Foot Director, Player Relations

Hometopia Inc.

Lead Engineer
More Jobs   


Explore the
Subscribe to
Follow us

Game Developer Job Board

Game Developer Newsletter


Explore the

Game Developer Job Board

Browse open positions across the game industry or recruit new talent for your studio

Subscribe to

Game Developer Newsletter

Get daily Game Developer top stories every morning straight into your inbox

Follow us


Follow us @gamedevdotcom to stay up-to-date with the latest news & insider information about events & more