Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Clone 10 objects. Each X+2 away from the last.
- static var already_cloned : bool = false;
- // Allow cloning once to prevent infinite cloning loop (as start is called on each clone!)
- function Start () {
- //If we have already been cloned, early exit.
- if (already_cloned) return;
- //If we haven't been cloned already
- Clone();
- already_cloned = true;
- }
- function Clone(){
- for (var i : int = 1;i <= 10; i++) {
- Instantiate(
- gameObject,
- transform.position + Vector3(i * 2.0, 0, 0),
- Quaternion.identity
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement