Description
The EverythingInSelfAndAncestors
field is a member of the FindMode
enumeration in the Sandbox namespace. This enumeration is used to specify the scope of a search operation for components or game objects within a scene. The EverythingInSelfAndAncestors
mode indicates that the search should include all components or game objects within the current object and all of its ancestor objects, up to the root of the hierarchy.
Usage
Use FindMode.EverythingInSelfAndAncestors
when you need to search for components or game objects not only in the current object but also in all of its parent objects. This is useful when you want to ensure that you are considering the entire hierarchy above the current object.
Example
// Example of using FindMode.EverythingInSelfAndAncestors
// Assume 'gameObject' is a reference to a GameObject in the scene
var components = gameObject.FindComponents<SomeComponent>(FindMode.EverythingInSelfAndAncestors);
// This will search for 'SomeComponent' in the current GameObject and all its ancestors.