Advertisement
selzero

Controlling Game Objects 4

Sep 22nd, 2012
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.70 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class GridCreator : MonoBehaviour {
  5.     public GameObject goTile;
  6.  
  7.     void Start () {
  8.  
  9.         //Create quaternion to use as the rotation
  10.         //of the instantiated object
  11.         Quaternion qRotation = new Quaternion();
  12.         //Create Vector3 to use as the position
  13.         //of the instantiated object
  14.         Vector3 v3Position = new Vector3();
  15.         //count ten X coordinates
  16.         for(int i=0; i<10; i++)
  17.         {
  18.             //count ten Y coordinates
  19.             for(int j=0; j<10; j++)
  20.             {
  21.                 //set the X coordinate
  22.                 v3Position.x = i;
  23.                 //set the Y coordinate
  24.                 v3Position.y=j;
  25.                 //Instantiate a tile.
  26.                 Instantiate(goTile,v3Position,qRotation);
  27.             }
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement