Example #1
0
        public static SerializeSprite SpriteSerialize(Sprite input)
        {
            Texture2D       texture = input.texture;
            SerializeSprite sprite  = new SerializeSprite(texture.width, texture.height, ImageConversion.EncodeToPNG(texture));

            return(sprite);
        }
Example #2
0
        public static Sprite SpriteDeSerialize(SerializeSprite input)
        {
            SerializeSprite sprite  = input;
            Texture2D       texture = new Texture2D(sprite.x, sprite.y);

            ImageConversion.LoadImage(texture, sprite.data);
            return(Sprite.Create(texture, new Rect(0f, 0f, texture.width, texture.height), Vector2.one));
        }