How I can access to a prefab generated in-game?

When I run mi game I have the next tree:
Imgur
I need to get the Colums (in the image is only one, but I have actually four), and the I need to access the Hex Cells to verify one variable of them. I try the next script

private void Awake()
    {
        GameObject gridObject = GameObject.Find("Hex Grid");
        HexGrid gridReference = gridObject.GetComponent<HexGrid>();
       
        //Debug.Log(gridReference.GetComponentInChildren);
    }

I can get the Hex Grid class, but when I fail trying to get the Colums.

  • Is possible to access them via script in-game?

Remember the first rule of GameObject.Find():

Do not use GameObject.Find();

More information: https://starmanta.gitbooks.io/unitytipsredux/content/first-question.html

It’s always best to drag references in directly.

If you are creating them dynamically, then put them in a list as you create them.

If there just is no central way for you to track these things as they are created, then in the above case you could search for HexGrid instances directly, perhaps with ONE of the following:

GetComponentsInChildren<T>();```

depending on if you know what part of your hierarchy to search or just to search globally.