Description
The EverythingInAncestors
field is a member of the FindMode
enumeration in the Sandbox API. This enumeration is used to specify the scope of a search operation for components or game objects within a scene hierarchy. The EverythingInAncestors
value indicates that the search should include all components or game objects in the current object’s ancestors, which means its parent, grandparent, and so on, up to the root of the hierarchy.
Usage
Use FindMode.EverythingInAncestors
when you need to search for components or game objects in all ancestor objects of a given object. This is useful when you want to find elements that are not directly in the current object or its children but are located higher up in the hierarchy.
Example
// Example of using FindMode.EverythingInAncestors
// Assume 'currentObject' is a GameObject in the scene
var componentsInAncestors = currentObject.FindComponents<SomeComponent>(FindMode.EverythingInAncestors);
// This will return all instances of SomeComponent in the ancestors of 'currentObject'.