Reputation: 617
I have a UnityEngine.Sprite
and need it to be stretched between two points.
How can I achieve this at runtime using Unity?
Upvotes: 0
Views: 2394
Reputation: 8230
If you want a runtime stretching effect
If you want it to fill the space instantly
Calculating scale
scale = targetSize / realSize;
So, given a space of 1000 x 400 pixels that you wish to fill with an 800 x 600 image...
scale.x = 1000 / 800;
scale.y = 400 / 600;
Upvotes: 1