Why do I need to type gameObject at the end of transform.Find("GameObject")

Start ()
{
thingName = parentThing.transform.Find(“GameObject”).gameObject;
}

That’s because the method “Transform.Find” will give you an object with the type of “Transform” where the properties, methods, or any members that you can access with the “.” (dot) operator are the only things that are listed here: documentation. As you can see, there’s a property named “gameObject” in the class, which means instead of giving you the actual “transform object” it found, it will give you that “gameObject” instead, where you can do things that are only specific to the type “GameObject,” see the documentation.


Another thing is that the string value inside the parentheses is just the “name” of the object you’re trying to find; it can be any value and has nothing to do with the logic.


Lastly, GameObject has a method “Find” as well; see. This will give you the object with the type of “GameObject” instead of a Transform.