Reference creator of gameObject


This is more of a general theory question. I have a 2D grid of tile objects, which each have a gameObject which gives the object it’s presence in the game world.
The tile object also holds an (x,y) coordinate pair, which is not equivalent to its real world position.

Is there any easy way of getting access to the tile objects variables through an event where the gameObject is clicked? At present, I can find no way of accessing the tileObject, as it references the gameObject, but the reverse is not true.


If you have a reference to the game object, you can use GetComponent() to get access to the Tile component:

There are multiple ways of using GetComponent(). I suggest the generic version:

Tile tile = gameObject.GetComponent<Tile>();