GetComponent in CSharp

Hello

Is there any other way to kill script by itself:

public class MySuperAwesomeScript : MonoBehaviour {
	...
	Destroy(GetComponent<MySuperAwesomeScript>());
	...
}

?

And is it possible to do something like this:
Destroy(GetComponent<this>())?

Thanks

    Destroy(this);

“this” keyword already refers to the instance of the class itself, so you don’t need any GetComponent calls

Tseng, thank you!

Hello again,

Is there any way to find script on the other object like:

public class MySuperAwesomeScript : MonoBehaviour {
	...
	SomeAnotherGameObject.GetComponent<this>();
	...
}

?

Thanks!

GetComponent is expecting a Type, not an instance; so this is the right syntax:

MySuperAwesomeScript otherScript = SomeAnotherGameObject.GetComponent<MySuperAwesomeScript>();

Thanks, but I knew that. I hoped that exist more simple way.

How exactly would this look like? The method Jean provided is the simplest you may find. Except you look for something involving extension methods:

someGO.DestroyComponent();

Not really worth the effort.