|
I'm instantiating a grid of cloned objects and need to apply a different texture to each depending on the values in a multidimensional array from a script attached to the main camera. I'm a bit rusty and can't remember how to give each instantiated object the appropriate texture. Can someone please help me out?
(comments are locked)
|
|
Something on the order of Each tile is being rendered with a pictures based on an array. currTile is an integer with the reference, hence GS_pics[currTile] pointing to the material I need to use. I tried instantiated with an array of Gameobjects but something seems to be wrong with the following line when I try that. GS_Tiles[currTile] = Instantiate(GS_Tile, pos, Quaternion.identity);
Jan 15 '11 at 02:59 AM
NewfieJoe
Turned out I simply forgot to add " as GameObject" at the end of the command. :P
Feb 19 '11 at 02:19 PM
NewfieJoe
Added some clarification to my answer
Feb 19 '11 at 07:46 PM
DaveA
(comments are locked)
|
|
This is for multiple objects in a grid that are spawned from script. Minimum of 81 for a small puzzle to a max of 324 for a large one, some using text, some with numbers, some with slices of a picture etc.. I can't figure how to reference them to change the materials after they are instantiated. Brain stalled. :P
Jan 15 '11 at 02:48 AM
NewfieJoe
(comments are locked)
|

In the end I created the objects off camera in the editor and cloned each one as needed. It's a cludgy way of doing it though.