0
votes

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);
1
Java is very different from JavaScript, which in turn is not the same as UnityScript that Unity likens to call JavaScript. Tags updated.LearnCocos2D
oh thank you so javascript is for website development ? or something like that ?Atilla
+ java and javascript isn't the same ?Atilla
No. Java is static, js is dynamic languageBarış Çırıka
not by a long shot! stackoverflow.com/a/5184356/201863 <= there are also helpful answers in that thread so look around ;)LearnCocos2D

1 Answers

0
votes

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