type | El tipo de Component para recuperar. |
Devuelve un componente de tipo type
si el game object tiene a alguno adjuntado, o null si no lo tiene.
// Disable the spring on the HingeJoint component. HingeJoint hinge = GetComponent<HingeJoint>(); hinge.useSpring = false;
Versión genérica. Para más detalles, mira la página de Funciones genéricas.
Devuelve el componente que sea de tipo type
si el game object tiene a alguno adjuntado, o null si no lo tiene.
It is better to use GetComponent with a Type instead of a string for performance reasons. Sometimes you might not be able to get to the type however, for example when trying to access a C# script from Javascript. In that case you can simply access the component by name instead of type. Example:
// Disable the spring on the HingeJoint component. HingeJoint hinge = GetComponent("HingeJoint") as HingeJoint; hinge.useSpring = false;