Advertisement
NPSF3000

Simply Unity Clone

May 26th, 2011
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Clone 10 objects.  Each X+2 away from the last.
  2.  
  3. static var Original : GameObject;
  4.  
  5. function Start () {
  6.     //Only run once, don't end up in an infinite loop!
  7.     if (Original == null) Original = gameObject;
  8.     if (Original == gameObject) Clone();
  9. }
  10.  
  11. function Clone(){
  12.     for (var i : int = 1;i <= 10; i++) {
  13.         Instantiate(
  14.                      gameObject,
  15.                  transform.position + Vector3(i * 2.0, 0, 0),
  16.                  Quaternion.identity
  17.                );
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement