<pre>
//....
Gameobject tile;
int count = 1f;
float posX = 0;
float posY = 0;
....//
GameObject blueTile = (GameObject)Instantiate(Resources.Load("block_blue"));
tile = (GameObject)Instantiate(blueTile, transform);
for loop {
...
...
tile.GetComponent<Button>().GetComponentInChildren<Text>().text = count.ToString();
tile.transform.position = new Vector2((float)posX, (float)posY);
count++;
}
</pre>
[![enter image description here][1]][1]
[![enter image description here][2]][2]
As you can see by the image.
My line of thinking goes like this; I used to create Flash/AS3 Applications and Games. I have used a number of API's and they usually have a lot in common. Unity, however, is very different and I may have not grasped the key concepts.
<p>
I want to access my PreFab, named in Assets/Resources (the root path)
<br>
"block_blue"
<p>
All I wan to do is set up a row and columns of a box with a number inside of it.
<p>
Before you go and ask, why the complicated mix of Objects? Well, Adobe had MovieClip and use of layers and also use of a timeline. Unity doesn't seem to have this in setting up a Scene (the Stage in Flash).
<p>
So, I set up a block that looks like this (right of main image 66):
It's a Canvas, to hold a Button, the button has a text. To move the Canvas, I put the Canvas inside a GameObject. This, to me, is like a MovieClip in Flash API.
<p>
**GameObject > ButtonLight, Button > TextBlack, Text**
<p>
I need to access TextBlack and also Text. Pretty easy right? I've been at this for 4 days, many many hours.
<p>
EDIT: It seems that it is working, somewhat.
<br>
Looking at the reference photo and the Hierarchy reference, it looks like the blackText behind the blueText is changing as expected. But I cannot access the top BlueText. The Blue Text is also a child of type Text, but it's a second (layer?) copy of the text inside of the Button. So, it's getting the first Child Text, but how to access the second Text?
[1]: https://i.sstatic.net/1ilMI.png
[2]: https://i.sstatic.net/KuCBE.png