-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Unity 4.x Game Development by Example: Beginner's Guide
By :

We're going to create a 2D array referencing our squares in an interesting way. Follow along.
Create a standard one-dimensional array to hold the squares by adding this declaration to the GameLogic
script:
var XPiece:GameObject;
var OPiece:GameObject;
var currentPlayer:int = 1;
var prompt:GUIText;
var aSquares:GameObject[];
Select the GameLogic
GameObject. Set the Size of the aSquares
array to 9
in the Inspector panel.
One by one, making sure you get all 9 unique squares with no repeats, click and drag the 9 Square
GameObjects from the Hierarchy panel into the array slots in the Inspector panel. Another way to accomplish this in a single shot is to leave the array size at 0
, and then select the GameLogic
GameObject and lock the Inspector (click the little lock icon at the top right of the panel). With the GameLogic
Inspector locked, you can select all the Squares and drag them en masse onto the array in the Inspector panel.
We're part of the way there...
Change the font size
Change margin width
Change background colour