internal Sprite GetSprite(int categoryHash, int labelHash, out bool validEntry)
        {
            SpriteLibCategory category = null;

            for (int i = 0; i < m_Labels.Count; ++i)
            {
                if (m_Labels[i].hash == categoryHash)
                {
                    category = m_Labels[i];
                    break;
                }
            }

            if (category != null)
            {
                SpriteCategoryEntry spritelabel = null;
                for (int i = 0; i < category.categoryList.Count; ++i)
                {
                    if (category.categoryList[i].hash == labelHash)
                    {
                        spritelabel = category.categoryList[i];
                        break;
                    }
                }
                if (spritelabel != null)
                {
                    validEntry = true;
                    return(spritelabel.sprite);
                }
            }
            validEntry = false;
            return(null);
        }
        /// <summary>
        /// Add or replace and existing Sprite into the given Category and Label
        /// </summary>
        /// <param name="sprite">Sprite to add</param>
        /// <param name="category">Category to add the Sprite to</param>
        /// <param name="label">Label of the Category to add the Sprite to. If this parameter is null or an empty string, it will attempt to add a empty category</param>
        public void AddCategoryLabel(Sprite sprite, string category, string label)
        {
            category = category.Trim();
            label    = label?.Trim();
            if (string.IsNullOrEmpty(category))
            {
                throw new ArgumentException("Cannot add empty or null Category string");
            }

            var catHash = SpriteLibraryAsset.GetStringHash(category);
            SpriteCategoryEntry categorylabel = null;
            SpriteLibCategory   libCategory   = null;

            libCategory = m_Labels.FirstOrDefault(x => x.hash == catHash);

            if (libCategory != null)
            {
                if (string.IsNullOrEmpty(label))
                {
                    throw new ArgumentException("Cannot add empty or null Label string");
                }
                Assert.AreEqual(libCategory.name, category, "Category string  hash clashes with another existing Category. Please use another string");

                var labelHash = SpriteLibraryAsset.GetStringHash(label);
                categorylabel = libCategory.categoryList.FirstOrDefault(y => y.hash == labelHash);
                if (categorylabel != null)
                {
                    Assert.AreEqual(categorylabel.name, label, "Label string hash clashes with another existing label. Please use another string");
                    categorylabel.sprite = sprite;
                }
                else
                {
                    categorylabel = new SpriteCategoryEntry()
                    {
                        name   = label,
                        sprite = sprite
                    };
                    libCategory.categoryList.Add(categorylabel);
                }
            }
            else
            {
                var slc = new SpriteLibCategory()
                {
                    categoryList = new List <SpriteCategoryEntry>(),
                    name         = category
                };
                if (!string.IsNullOrEmpty(label))
                {
                    slc.categoryList.Add(new SpriteCategoryEntry()
                    {
                        name   = label,
                        sprite = sprite
                    });
                }
                m_Labels.Add(slc);
            }
#if UNITY_EDITOR
            EditorUtility.SetDirty(this);
#endif
        }