UnityEngine.GameObject.GetComponents C# (CSharp) Method

GetComponents() public method

public GetComponents ( Type type ) : UnityEngine.Component[]
type System.Type
return UnityEngine.Component[]
		public Component[] GetComponents(Type type){}
		public T[] GetComponents(){}

Same methods

GameObject::GetComponents ( ) : T[]

Usage Example

Example #1
0
    void enablePlayer(GameObject player)
    {
        foreach (MonoBehaviour obj in player.GetComponents<MonoBehaviour>())
            obj.enabled = true;

        foreach (CharacterController obj in player.GetComponents<CharacterController>())
            obj.enabled = true;
    }
All Usage Examples Of UnityEngine.GameObject::GetComponents