- Home /
Question by
seth · Sep 20, 2010 at 03:50 AM ·
instantiatechess
Creating a board and naming each piece.
Imagine you are creating a board. a chess board. Instantiating. where you would want each square to have a number. first square that's created has number 1 in it's script (var number = 1;) second - 2, third 3 etc. How would you pull that trick, I'm curious.
Comment
Answer by AliAzin · Sep 20, 2010 at 05:29 AM
you can access your instantiated object parameters like this:
for (i=0; i<10 ; i++){
var go : GameObject = Instantiate (prefab); go.GetComponent(yourScript).number = i;
}
Your answer
Follow this Question
Related Questions
Checking if object intersects? 1 Answer
Projectile instantiation positioning is off. 3 Answers
Instantiate ground/enemies 1 Answer
Random instantiate script 1 Answer