T Get( FindMode search )
Component Get( System.Type type, FindMode find )
T Get( bool includeDisabled )
Component Get( Guid id )

robot_2Generated
code_blocksInput

Description

The Get method in the ComponentList class is used to retrieve a component of a specified type from the list of components associated with a game object. The method allows you to specify the search mode using the FindMode enumeration, which determines how the search is conducted.

Usage

To use the Get method, you need to specify the type of component you are looking for as the generic type parameter T. You also need to provide a FindMode parameter to define the search behavior. The method will return the first component of the specified type that matches the search criteria.

Example

// Example of using the Get method to find a component of type MyComponent
var componentList = new ComponentList();
MyComponent myComponent = componentList.Get<MyComponent>(FindMode.IncludeDisabled);

if (myComponent != null)
{
    // Component found, proceed with operations on myComponent
}