2D Collision detection is broken when V-Sync is disabled

Hi, idk how is this working, but in my game LAZERS, you need to be next to a weapon to take it by pressing a button

Everything is working fine in the editor and in build too, when V-Sync is enabled
If not, the collision is detected 1/4 time, that’s very anoying…

Here is how my script is detecting the gun’s trigger :

    void OnTriggerStay2D(Collider2D collider)
    {
        if (collider.gameObject.tag == "Weapon")
        {
            if (gamemanager.keyboard && playerNumber == 4) {
                if (Input.GetKeyDown(gamemanager.take) && cooldown <= 0 && !haveWeapon)
                {
                    gamemanager.vibration[playerNumber - 1] += 0.2f;
                    Weapon weapony = collider.gameObject.GetComponent<Weapon>();
                    if (weapony != null)
                    if (weapony.playerEquiped != null)
                    {
                            weapony.playerEquiped.haveWeapon = false;
                            weapony.playerEquiped.weapon = null;
                    }
                    weapon = collider.gameObject;
                    weapon.transform.parent = gameObject.transform;
                    weapon.GetComponent<Weapon>().playerEquiped = this;
                    weapon.GetComponent<Weapon>().equiped = true;
                    haveWeapon = true;
                    takeWeaponSound.pitch = takeWeaponSound.pitch = Random.Range(1f, 1.2f);
                    takeWeaponSound.Play();
                    if (weapon.GetComponent<Weapon>().part != null) weapon.GetComponent<Weapon>().part.gameObject.SetActive(false);
                    cooldown = 0.1f;
                }
            }
        }
    }

Clamp your max framerate and disable VSync by using Application.targetFrameRate to the refresh rate of your monitor to see if your problem is framerate dependant. If it is, it means some part of the Collision detection is framerate dependant.

Looks like you need to change collision detection mode on rigid body from discreet to continuous.

108992-capture.png