Editor automatically presses keys after scene started

Hello, so I was recently testing the editor to see if there was a bug regarding automatic key press. I simply added a plane, cube, and a script attached to the cube here:

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

public class keyPressBug : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
   
    }

    // Update is called once per frame
    void Update()
    {
        if(Input.GetKeyDown(KeyCode.S));
        {
            Destroy(gameObject);
            print("s pressed");
        }
    }
   
}

As shown, I want the cube to disappear only when I press the key. However, the cube disappears right after I hit the play button and it prints to let me know that the key was already pressed! How can I resolve this issue?

In an otherwise-empty project??

If so, use that project and file a bug with Unity (Help → Report A Bug)

Otherwise, make an empty project and verify it fails there.

If it doesn’t fail there, bisect back to your project.

1 Like