I have this sort of hierarchy in the Unity editor (Bingo3D):
Options->Pattern2Row->Card->Counter1
…
Counter25
Pattern2Col->Card->Counter1
…
Counter25
PatternX->Card->Counter1
…
Counter25
Counters 1-25 are just small circles used to represent the buttons placed by players on their bingo card and they are children of the Card objects if that is not clear above.
The game objects with the name ‘Card’ are just 2D sprites representing the bingo cards.
Scripts/classes of the same name are attached to Pattern2Row, Pattern2Col and PatternX
These scripts/class are derived from a parent script/class called PatternManager and simply set an enumerated type member variable, in their constructors.
The base script/class then use that enumerated type member variable to determine which pattern to display on the bingo card sprite, i.e. by simply showing and hiding Counter1-25. In effect it is an animation I suppose and could have been done with blender…but never mind.
In the base script/class I have GameObject members like this:
private GameObject m_gameobjCounter1;
…
private GameObject m_gameobjCounter25;
I want to use GameObject.Find(“…”) to set each of these GameObject members to the appropriate game object in the Unity editor hierarchy described above.
In effect I am trying to avoid having to drag and drop over 100 game objects in the Unity editor and also quarantine the links from any changes I might want to make that involves removing or moving scripts - often when you do that sort of thing Unity editor deletes all the links and you have to drag and drop all over again.
So my question…
I know that you can specify a path as well as a name in GameObject.Find(“…”)
But how can I ensure, for example, that the path “Card/Counter1” refers to “Pattern2Row->Card->Counter1” for the instance of the script/class attached to Pattern2Row game object in the Unity editor?