I need to resize an image to be sur it’s a square
So I do
var rectTransform = GetComponent<RectTransform>();
var width = rectTransform.rect.width;
var height = rectTransform.rect.height;
if (Math.Abs(width - height) > 0.1f)
{
float size = width < height? width : height;
transform.localScale = new Vector3(size/width,size/height);
}
When i play it i see that the rectTransform has the good size but the sprite as disapear an the image is now transparent, does somebody know about it?
Using unity V4.6b20
Best
MARQUIS Vincent