Sprite component has no scale property (SOLVED)

Hello Defold Forums!

first time poster here starting off with a nice and easy question. Am I missing something or is there no way to adjust a Sprite component’s scale from the property view (aside from adjusting the scale of it’s parent gameobject)? Seems like you can do it from script so it’s weird that it’s not exposed in the editor.

You cannot do this from a script.

The Defold way of doing this is to attach a child GO with a sprite on it onto a parent GO and then scaling the child GO to scale the sprite independently. If you are making prefabs then you will make a collection and put multiple GOs in it, then you can message pass between those GOs easy because it’s relative to each other. And instead of a factory you would use a collection factory to generate the prefab.

1 Like

oh I see, so the scale property mentioned here https://www.defold.com/ref/sprite/#scale is actually just the scale of the GO that owns the sprite component? I guess I just expected the sprite to have it’s own scale since it has it’s own position.

thanks for the help :grinning:

Yes, we all would… I think there is a good technical reasoning for it though. Extra GOs are no problem and clean too. Making prefabs with collections instead of plain GOs is also just as easy and cleaner in the long run.

3 Likes