-
-
Save Gojeflone/9043701 to your computer and use it in GitHub Desktop.
For loops in Unity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myPrefab : Rigidbody; | |
var distanceMultiplier : float = 2; | |
function Start(){ | |
var i : int = 0; | |
var pos : Vector3 = transform.position; | |
for(i=0; i<=3; i++){ | |
Instantiate(myPrefab, Vector3(pos.x+i*distanceMultiplier, pos.y, pos.z), transform.rotation); | |
yield WaitForSeconds(0.5); | |
Debug.Log("made ball "+i); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment