/// <summary>
    /// Destroys the atlas and the resources that it uses.
    /// </summary>
    public void Destroy()
    {
        if (atlas != null)
        {
            numberOfUnused = 0;

            atlas.ClearAllSpriteData();

            if (AtlasTexture != null)
            {
                Object.Destroy(AtlasTexture);
                AtlasTexture = null;
            }
        }
    }