how to activate a gameobject after a click and then deactivate it a seconds after?

I’m developing a small game for Hololens through unity and i’m having trouble on how to use my flamethrower effect.

as for now i tried activating the prefab after the onTap event but then it stay enabled once and for all.
I tried activating the prefab and deactivating it but it doesn’t work. I also tried using a coroutine that takes a boolean that activates the prefab accordingly to the boolean value.

the code is something like this

 public void Start()
    {
        StartCoroutine(onOff(state));
    }
    
    public void OnInputClicked(InputClickedEventData eventData)
    {
        onOff(!state);
        GameManager.Instance.score++;
        if (GameManager.Instance.score > GameManager.Instance.highScore)
            GameManager.Instance.highScore = GameManager.Instance.score;
        state = false;
    }

   IEnumerator onOff(bool s)
    {
        if (s)
        {
            flare.SetActive(s);
            yield return new WaitForSeconds(1f);
            flare.SetActive(!s);
            s = false;
            state = false;
        }
    }

i’m really is not sure about the coroutine itself.
Any suggestion is well accepted.

You’re only going to do any of the work in your onOff method if you’re passing in true, due to your first if check. Remove that, and you should see an improvement.