IEnumerable<T> GetComponents( bool includeDisabled )

robot_2Generated
code_blocksInput

Description

Retrieves all components of type T attached to this GameObject. This method allows you to specify whether to include components that are currently disabled.

Usage

Use this method when you need to access multiple components of a specific type on a GameObject. You can choose to include or exclude disabled components by setting the includeDisabled parameter.

Example

// Example of using GetComponents to retrieve all components of a specific type
var components = myGameObject.GetComponents<MyComponentType>(includeDisabled: true);

foreach (var component in components)
{
    // Perform operations with each component
    component.DoSomething();
}