bool IsDescendant( GameObject decendant )

book_4_sparkGenerated
code_blocksInput

Description

The IsDescendant method determines if a specified GameObject is a descendant of the current GameObject. A descendant is any object that is a child, grandchild, or further down the hierarchy of the current object.

Usage

To use the IsDescendant method, call it on a GameObject instance and pass another GameObject as the parameter. The method will return true if the passed GameObject is a descendant of the current GameObject, otherwise it will return false.

Example

// Example usage of IsDescendant method
GameObject parentObject = new GameObject();
GameObject childObject = new GameObject();
childObject.SetParent(parentObject, true);

bool isDescendant = parentObject.IsDescendant(childObject);
// isDescendant will be true because childObject is a direct child of parentObject.