I want to run a if statement for few seconds.How can I do it? : <p>I want to make a  code run for a few seconds in if statement like <strong>I want to
make BoxCollider.enabled=false whenever I press "e" and make BoxCollider.enabled=true again after a few seconds</strong>. How can I do this?</p>

<p>I tried the invoke method but it's not working.</p>

<pre><code>    if (Input.GetKeyDown("e"))

    {
        BoxCollider.enabled = false;

        Invoke("enable", 2f);
    }

    void enable()

    {
        BoxCollider.enabled = true;

     }
</code></pre>
