Quantcast
Channel: Questions in topic: "write-my-code"
Viewing all articles
Browse latest Browse all 92

Fading GUI text

$
0
0
Ive been looking around and from different posts I've put together a script that has a GUI text in the middle of the screen for certain amount of time. However it doesn't seem to work properly. The GUI text is there but its very small and its not in one line, also it fails to fade away. could someone find where I've gone wrong. Thanks var color : Color; function Start() { color = Color.white; yield FadeOutAfterTime(5); } function OnGUI () { var centeredStyle = GUI.skin.GetStyle("Label"); centeredStyle.alignment = TextAnchor.UpperCenter; GUI.Label (Rect (Screen.width/2-50, Screen.height/2-25, 100, 50), "Level 1", centeredStyle); } function FadeOutAfterTime(time : float) { yield WaitForSeconds(5); yield Fade(); } function Fade() { while (color.a > 0) { color.a -= Time.deltaTime; yield; } }

Viewing all articles
Browse latest Browse all 92

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>