Overlapsphere not working multiple times

Hi there, a little new to this but I’ve been having an issue with the overlapsphere code I’m trying to use to pick up objects in my game.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SC_PickUpItem : MonoBehaviour
{
    
    [Header("Control and Animations")]
    [SerializeField] private Animator anim;
    [SerializeField] private SC_AttackScript attackScript;

    [Header("Overlap Sphere Inputs")]
    [SerializeField] Collider[] grabbedItem;
    [SerializeField] Vector3 midPoint = new Vector3();
    [SerializeField] private float grabRange;

    // Start is called before the first frame update
    void Start()
    {
        anim = GetComponent<Animator>();
        attackScript = GetComponent<SC_AttackScript>();
        
    }

    void OnGrab()
    {
        midPoint = transform.position;

        if (anim.GetBool("Grounded") == true && attackScript.inputStagger == false)
        {
            attackScript.inputStagger = true;

            //Overlapsphere code
            grabbedItem = Physics.OverlapSphere(midPoint, grabRange);

            foreach (var collider in grabbedItem)
            {
                if (collider.tag == "PickUp")
                {
                    ItemPickup();
                }
            }
        }
    }

    private void ItemPickup()
    {
        anim.SetBool("Grab", true);
        //Play Pickup script
        Debug.Log("Picking Up Item");
    }

Basically, I wanted to use an overlap sphere to take in the objects around the player when they push the grab button. If there is a pickup in range, it’ll play the pickup animation and run a script on the other item.

The issue I’m having is that this code will only work once, anytime you push grab after the first time, it never takes in any new objects again. Hope someone can help and that I posted this right.

Where are you calling the OnGrab function? Add a Debug.Log to make sure you are calling it as many times as you expect.

Beyond that it would simply be the if attackScript.inputStagger == false and in that if you set that to true. If you never reset that to false then the if will no longer be true.

Thanks a ton @CodeMonkeyYT

I was resetting attackScript.inputStagger but only when the animation played the pick up animation. Works just great now, I really appreciate the help.