- Home /
Question by
Cambesa · Feb 27, 2020 at 04:21 PM ·
texture2dspritesspritesheetreplace
Copying sprite sheet/atlas and replace texture
I'm running a blur script over sprites in the editor, this works for Sprite Mode Single by the code below:
SpriteRenderer sr = GetComponent<SpriteRenderer>();
Texture2D blurredTexture=BlurTexture(sr.sprite.texture);
sr.sprite = Sprite.Create(blurredTexture, new Rect(0, 0, blurredTexture.width, blurredTexture.height), sr.sprite.pivot / spriteSize);
But not for Sprite Mode Multiple(eg. spritesheet/atlas). Is there any way to copy the sliced sprites including pivots and replace only the associated texture?
Comment
Your answer
Follow this Question
Related Questions
2D sprite renders a small part of another one with "Sprite Mode : Multiple" 0 Answers
"Could not create sprite" exception - copying and manipulating texture from SpriteAtlas 1 Answer
Getting the sprite borders from a Texture2D? 1 Answer
How to tile sprite in 2D game when scaling instead of stretching 2 Answers
How to replace/update sprites/prefabs on existing game? 1 Answer