Method FindChild
- Namespace
- Gamelogic.Extensions
- Assembly
- Gamelogic.Extensions.dll
FindChild(Component, string)
Finds a direct child of the component's transform with the given name.
public static GameObject FindChild(this Component component, string childName)
Parameters
componentComponentThe component whose transform to search.
childNamestringThe name of the child to find.
Returns
- GameObject
The child's GameObject.
FindChild(Component, string, bool)
Finds a child of the component's transform with the given name, optionally searching recursively.
public static GameObject FindChild(this Component component, string childName, bool recursive)
Parameters
componentComponentThe component whose transform to search.
childNamestringThe name of the child to find.
recursiveboolIf true, searches only the direct children; if false, searches the entire hierarchy.
Returns
- GameObject
The matching child's GameObject, or null if not found.