Unity not recognising space bar and left click

Hi all!
Currently making a simple first game in Unity.

When the user uses a key, the character should jump (2D game btw). However, the space bar and left click are not registering. When I use anyKeyDown it detects every other key I’ve tried. The space bar, when used, interacts with Unity instead of the game ie. opens a drop down menu in the game window. Mouse click does something along the same lines. Same happens when use Input.GetKeyDown(KeyCode.Space) and Input.GetMouseButtonDown(0), respectively.

void Update()
{
    if(Input.anyKeyDown)
    {
        didFlap = true;
    }
}

Thanks in advance!

can you show us the script that you use?

using UnityEngine;
using System.Collections;

public class BirdMovement : MonoBehaviour {

    Vector3 velocity = Vector3.zero;
    public Vector3 gravity;
    public Vector3 flapVelocity;
    public float maxSpeed = 5f;

    bool didFlap = false;

	// Use this for initialization
	void Start () {
	
	}

    // Do Graphic & Input updates here
    void Update() {
        if(Input.GetKeyDown(KeyCode.Space) || Input.GetMouseButtonDown(0) ) {
            didFlap = true;
        }
    }
	
	// Do physics engine updates here
	void FixedUpdate () {
        velocity += gravity * Time.deltaTime;

        if(didFlap == true) {
            didFlap = false;
            velocity += flapVelocity;
        }

        velocity = Vector3.ClampMagnitude(velocity, maxSpeed);

        transform.position += velocity * Time.deltaTime;

        float angle = 0;
        if (velocity.y < 0) {
            angle = Mathf.Lerp(0, -90, -velocity.y / maxSpeed);
        }

        transform.rotation = Quaternion.Euler(0, 0, angle);
	}
}

For context: Flappy Bird clone

if you go to edit—project settings—input it should tell you what you can type for space or ‘‘jump’’.
if you need a simple 2d jump script see if this works

public float jumpForce = 7.5f;

void Update()
{
    if (Input.GetKeyDown(KeyCode.Space))
    {
        GetComponent<Rigidbody2D>().velocity = new Vector2(GetComponent<Rigidbody2D>().velocity.x, jumpForce);
    }
}

this is not tested btw. Hope it helps @paulvincentphillips

Interesting. The behaviour you describe is present if you have toggled sticky keys to be on. In which case pressing space will act as a menu open instead of a standard key press.

If you are on windows check under accessibility, that you don’t have sticky keys or any of those settings enabled. Not sure where this setting lives on a mac.

I am having the same issue with using space button, though I do not get a menu action from using it. Have not tested this with the left mouse so far. If you find a fix I would love to know.

Go to Event System gameobject → Standalone Input Module component → Replace with InputSystemUIInputModule. It works for me.