I have already tried really much with all "GetChildren" and similar functions, but I haven't found out how to do it yet.
I have a GameObject named "koffer". I have added several other GameObjects as children to it.
I have added a script to "koffer" in which I try to retrieve the children. In this script I have stated this line:
string sThis = this.name; //just for testing. "sThis" becomes "koffer", so it looks perfectly fine. foreach (GameObject g in this.GetComponentsInChildren<GameObject>()) // doesn't retrieve anything. So obviously I'm not doing it correctly.
However this doesn't retrieve anything. Is this not the correct function for such a case?
Is there any built-in function to retrieve theses game obects?
I have found several custom made functions from some years ago, and I don't know if they are still needed or if Unity has integrated some functions for that.
What really bothers me is that there are so many custom-made functions that deal with "Transform" instead of "GameObject". Why would somebody need Transform instead of GameObject?