Quantcast
Channel: Questions in topic: "loops"
Viewing all articles
Browse latest Browse all 184

Looping through numbered scenes

$
0
0
I'm new to Unity and trying to create a simple memory game where objects on unique backgrounds appear on the screen for a few seconds in a specified order. Each object is it's own scene number 1-60. I am trying to load the scenes with some repetition so that the sequence would be to load the scenes in an order like (1,3,2,1,5,8,2,3,9,5.....). My attempt at coding this is below. I'm trying to index into the variable levels to load that level in sequence. This however, does not work. var levels = ["2", "3", "1", "4", "1","2", "8", "3", "7", "1","8"]; static var MyInt: int = 1; function Update(){ //print(MyInt); var thisValue: String =levels[MyInt]; //print(thisValue); var scene:String = thisValue.ToString(); print(scene); Application.LoadLevel(scene); MyInt=MyInt+1; }

Viewing all articles
Browse latest Browse all 184

Trending Articles



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