Retrieves all components of type T
attached to this GameObject
. This method allows you to specify whether to include components that are currently disabled.
Retrieves all components of type T
attached to this GameObject
. This method allows you to specify whether to include components that are currently disabled.
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 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(); }