Quantcast
Channel: Questions in topic: "error"
Viewing all articles
Browse latest Browse all 7934

[Solved]Next and Previous Images of Array

$
0
0
Holla, i've try to do some code, and with my not-so-good-algorithm-brain it comes up on a dead end.. so, here's my code. #pragma strict var images : Texture2D[]; function OnGUI () { var i : int; GUI.DrawTexture(Rect(200,50,100,100),images[i]); if(GUI.Button(new Rect(210,300,100,50),"next texture")){ print(i); i++; GUI.DrawTexture(Rect(200,50,100,100), images[i]); print(i); } if(GUI.Button(new Rect(100,300,100,50),"previous texture")){ i--; GUI.DrawTexture(Rect(200,50,100,100), images[i]); print(i); } } i know that my code is so lame, and weird.. *haha but i think i need something like to repaint the gui drawtexture.. the i always saying 1 and 0 only, everytime i press Next texture button, it shows up 0 and 1, then press it again, 0 and 1 again.. doesn;t the counter should go up? or because i put the var and GUI.DrawTexture on the top of the if's? Thanks for further help, some poniter will be appreciated :)

Viewing all articles
Browse latest Browse all 7934

Trending Articles



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