0

I want to change sprite x and y size for fit the screen width and screen heigh. How can i use Screen.height and Screen.width functions on it ? I tried GUI.Label but it is not what i want.

(0,Screen.height/2 -Screen.height/4,Screen.width,Screen.Heigh/2) pozition and size value should have but when i use GUI.Label and change size the sprite size doesnt change. Sorry for my english. Thank you ...

This is what i tried:

GUI.Label ( new Rect (0,Screen.height/2 -Screen.height/4,Screen.width,Screen.Heigh/2) ,  image);
CodeSmile
  • 64,284
  • 20
  • 132
  • 217
Atilla
  • 1
  • 1
  • 2

1 Answers1

0

As mentioned in the comments you might want to check out the new UI system in 4.6.x

However, if you want to use GUI functions then maybe look into GUI.DrawTexture as it will let you scale your texture to the size you want in a number of ways depending on the scale mode you choose.

For your sprite to fill the screen however, you will want to use the Rect:

new Rect(0, 0, Screen.width, Screen.height); //left, top, width, height
Dover8
  • 607
  • 3
  • 17