onTriggerEnter2D Won't work (JS)

Dear Unity Community,

I’ve got a problem with the onTriggerEnter2D function, since it’s not working, and at the same time, I’m not aware of what is going wrong.
Note that I have searched this problem in other forums and threads, and their solution still didn’t work with me.

So, basically what I’ve got is two 2D-objects (sprites) and both of them got aswell a rigidbody2D as a circle collider 2D. I have ‘is Trigger’ checked on both of them, and I’ve got ‘is Kinematic’ unchecked in both rigidbodys.
Also I’ve tried all sorts of possible combinations, testing around with the colliders and rigidbodys.

Now my code is this:

Code (JavaScript):

#pragma strict
 
 
var velocity : Vector2;
var objectInReach : boolean = false;
 
function Update () {
 
transform.position = transform.position + (velocity * Time.deltaTime);
 
 
}
 
function onTriggerEnter2D(other: Collider2D)
{
    objectInReach = true;
    Debug.Log(objectInReach);
    Debug.Log("collision!");
   
    if(other.gameObject.tag == "player" || other.gameObject.tag == "buttonSprite")
    {
        Debug.Log("collision!");
        Debug.Log(objectInReach);
    }
 
}

(My moving object is tagged “player”, and my static object is tagged “buttonSprite”)

You can see that by now I’m desperately trying multiple things out in my code.

Please, if you know what I’m doing wrong, let me know.

I guess is because your on trigger function name are wrong

try change to

function OnTriggerEnter2D(other: Collider2D)