void OnMouseDown not working

can someone tell me why this void onMouseDown isn’t working? I wrote it correctly.
void OnMouseDown()
hook = wall.AddComponent(typeof(SpringJoint)) as SpringJoint;
hook.connectedBody = UwU;

Try to write like this:

    private void Update
            if (Input.GetMouseButton(0))
    hook = wall.AddComponent(
          typeof(SpringJoint)) as SpringJoint;
    hook.connectedBody =  UwU;

Google is your friend:


Or you could try Unity.EventSystems, works great whenever I used it.

Have you made sure that the object you want the onMouseDown to work on, has a collider attached to it.
Cause the onMouseMove function won’t work unless a collider is attached to the gameobject