Hi, total noob here, sorry for not being able to make sense out of answers to similar questions here.
I’m instantiating a tile, which is a prefab sprite with a script component and some text.
The text shows the value of a variable of the script.
As I’ve instantiated the whole thing, I now have a bunch of tiles, each with their own text.
So far so good. However, all of these variables are the same actual variable. I can’t figure out how to instantiate each script’s variable.
for each tile i’m trying this:
TileArray*.GetComponent<tiledata>().TileValue += 1;*
text.text = “” +TileArray*.GetComponent().TileValue;*
Instead of having each individual tile get +1, it’s adding +1 to the same instance of the variable.
Tile 1 value = 1
Tile 2 value = 2
etc.
What I want is to have each for loop add +1 to an instantiated variable, resulting in:
Tile 1 value = 1
Tile 2 value = 1
Hope any of this makes sense…
Cheers guys!