type | The type of Component to retrieve. |
Returns the component of Type type
if the game object has one attached, null if it doesn't.
// Equivalent to: Transform curTransform = transform; var curTransform : Transform; curTransform = GetComponent (Transform); // You can access script components in the same way as other components. function Start () { var someScript : ExampleScript; someScript = GetComponent (ExampleScript); someScript.DoSomething (); }
no example available in C#
no example available in Boo
Generic version. See the Generic Functions page for more details.
Returns the component with name type
if the game object has one attached, null if it doesn't.
// To access public variables and functions // in another script attached to the same game object. var script : ScriptName; script = GetComponent("ScriptName"); script.DoSomething ();
no example available in C#
no example available in Boo