How to get GameObject in OnTriggerEnter2D(obj) JS?

I do like in tutorial:

function OnTriggerEnter2D(obj) {
var name = obj.gameObject.name;

if (name == “bullet(Clone)”) {
Destroy(gameObject);
Destroy(obj.gameObject);
}

if (name == “spaceship”) {
Destroy(gameObject);
}

and i cant get an game object from obj.
I got bla bla… GameObject is not member of object, and if i using obj not working too.
Seems like here is unity strongly bugged.

You need to have a look at the doc, because what you have is not right. Your function parameter doesn’t declare a type.
Unity isn’t bugged, just follow the example and declare your type and it will be fine.

If you’re doing the space shooter demo, you can look at their code here.

Also, there is no need to put in a survey.

You have to change “function OnTriggerEnter2D(obj)” to “function OnTriggerEnter2D(obj : Collider2D)”