void ISpriteEditorDataProvider.Apply()
        {
            var so = GetSerializedObject();

            m_SpriteSingle.Apply(so);
            var spriteSheetSO = so.FindProperty("m_SpriteSheet.m_Sprites");
            Dictionary <GUID, SpriteDataExt> newSprites = new Dictionary <GUID, SpriteDataExt>();

            foreach (var newSprite in m_SpritesMultiple)
            {
                newSprites.Add(newSprite.spriteID, newSprite);
            }

            if (spriteSheetSO.arraySize > 0)
            {
                var validateCurrent = spriteSheetSO.GetArrayElementAtIndex(0);
                for (int i = 0; i < spriteSheetSO.arraySize; ++i)
                {
                    var guid = SpriteRect.GetSpriteIDFromSerializedProperty(validateCurrent);
                    // find the GUID in our sprite list and apply to it;
                    if (newSprites.TryGetValue(guid, out SpriteDataExt smd))
                    {
                        smd.Apply(validateCurrent);
                        newSprites.Remove(guid);
                        validateCurrent.Next(false);
                    }
                    else// we can't find it, it is already deleted
                    {
                        spriteSheetSO.DeleteArrayElementAtIndex(i);
                        --i;
                    }
                }
            }

            // Add new ones
            int newCount = newSprites.Count();

            if (newCount > 0)
            {
                var idx = spriteSheetSO.arraySize;
                spriteSheetSO.arraySize += newCount;
                var addCurrent = spriteSheetSO.GetArrayElementAtIndex(idx);
                foreach (var newSprite in newSprites.Values)
                {
                    newSprite.Apply(addCurrent);
                    addCurrent.Next(false);
                }
            }

            SpriteSecondaryTextureDataTransfer.Apply(so, m_SecondaryTextureDataTransfer);
            so.ApplyModifiedPropertiesWithoutUndo();
        }
        void ISpriteEditorDataProvider.Apply()
        {
            var so = new SerializedObject(m_TextureImporter);

            m_SpriteSingle.Apply(so);
            var spriteSheetSO = so.FindProperty("m_SpriteSheet.m_Sprites");

            GUID[] guids = new GUID[spriteSheetSO.arraySize];
            for (int i = 0; i < spriteSheetSO.arraySize; ++i)
            {
                var element = spriteSheetSO.GetArrayElementAtIndex(i);
                guids[i] = SpriteRect.GetSpriteIDFromSerializedProperty(element);
                // find the GUID in our sprite list and apply to it;
                var smd = m_SpritesMultiple.Find(x => x.spriteID == guids[i]);
                if (smd == null) // we can't find it, it is already deleted
                {
                    spriteSheetSO.DeleteArrayElementAtIndex(i);
                    --i;
                }
                else
                {
                    smd.Apply(element);
                }
            }

            // Add new ones
            var newSprites = m_SpritesMultiple.Where(x => !guids.Contains(x.spriteID));

            foreach (var newSprite in newSprites)
            {
                spriteSheetSO.InsertArrayElementAtIndex(spriteSheetSO.arraySize);
                var element = spriteSheetSO.GetArrayElementAtIndex(spriteSheetSO.arraySize - 1);
                newSprite.Apply(element);
            }

            SpriteSecondaryTextureDataTransfer.Apply(so, m_SecondaryTextureDataTransfer);
            so.ApplyModifiedPropertiesWithoutUndo();
        }