Force GetMouseButtonUp

I’ve got an action in my game that has you clicking and holding and then something fires off on releasing, but I want to have it on a timer so that it automatically releases after X amount of time.
The problem is even doing things like making a bool part of the mousebuttondown if statement and then disabling it after a certain time doesn’t stop the current mousebuttondown. I need a way to force end the current action, basically forcing mousebuttonup without the input of the player. Any ideas?

You actually also have the function GetMouseButton( ) that detects when the mouse is being held and not just when it is pressed or released, you could make a timer so that the action only fires off after a certain amount of time, here’s an example:

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

public class MouseButton : MonoBehaviour
    public float delay = 10f;
    float timepassed = 0;

    // Update is called once per frame
    void Update()
        if(Input.GetMouseButton(0) && timepassed > delay){          
            timepassed = 0;
        timepassed += Time.deltaTime;

where the delay is the time in the number of seconds you want to wait for before doing the action again.
Regardless of whether the user is having the mouse pressed all the time or not, the action will not be fired until the indicated time has passed