- Home /
How to resize nested sprite
I have a sprite that is nested inside a button. The button itself has a sprite that acts as a frame for a profile image (the sprite nested inside it). This allows me to swap out the inner profile image on demand without changing the outer frame.
The problem is that there seems to be no tool in the editor that is capable of resizing this setup. The rect tool resizes the button with the frame sprite just fine, but doesn't resize the nested sprite at all. The scale tool also resizes the button, but causes the nested sprite to disappear because it's changing the Z scale (this is a 2D scene). I tried using layout groups and content size fitters, but neither work.
The only way I've found to resize both the button and the nested sprite is to manually change the X and Y scale values in the inspector. Surely there's an easier way?
EDIT: Here is the sprite in the inspector:
What do your anchors for the Rect Transform on the sprite look like?
Answer by qobion · Nov 22, 2019 at 10:46 PM
Choose 'stretch' instead of 'middle center' on nested sprite
I had tried all of the stretch options, but the behavior is always the same - the outer sprite resizes, but the nested one doesn't.
Your answer
Follow this Question
Related Questions
Asset Automatically Re-Sizing (On it's own) 1 Answer
How to covert a rectTransform scale to world scale? 1 Answer
How to change the scale of a sprite from the c# script? 1 Answer
Resize the resolution of a sprite sheet and maintain the proportion percentage of the slices. 2 Answers
Smoothly changing scale on an arbitrary mesh - mobile 1 Answer