Godot 4 telling me "BUTTON_LEFT" is not declared

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Burloe

I upgraded to beta and in the process of trying to get the code working but I’m stuck on this particular part.

	if event is InputEventMouseButton and event.pressed and event.button_index == BUTTON_LEFT:

I have two more if statements in the same script and all are giving me the same “Identifier “BUTTON_LEFT” not declared in current scope” error. But when I look at at the docs under the “Mouse Motion” section. it gives an example where they use the same “BUTTON_LEFT”. I know the docs aren’t stable and can include old examples/documentations in certain sections. Does anyone know what to do here?

Thanks in advance!

This looks correct to me.

magicalogic | 2023-01-13 11:53

I think in Godot 4 it should be MOUSE_BUTTON_LEFT instead of BUTTON_LEFT
@GlobalScope — Godot Engine (latest) documentation in English

sporx13 | 2023-01-13 12:22

You’re right! Thank you.
I was loooking at this page where it uses what I assume is an old example.
Input examples — Godot Engine (latest) documentation in English

Burloe | 2023-01-13 12:27

:bust_in_silhouette: Reply From: Burloe

Sporx13 provided the answer:

I think in Godot 4 it should be MOUSE_BUTTON_LEFT instead of BUTTON_LEFT
@GlobalScope — Godot Engine (latest) documentation in English