Error: The identifier "ui_select" is not defined in this scope

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

I was trying to do a test so I could figure out player movement and input, but I got the error in the title. Here’s my code:
_process(_delta): if is_action_pressed(ui_select): is_pressed = 1 else: is_pressed = 0
Anybody have any idea what I can do? I’m a complete beginner with no real experience with coding outside of Scratch.

:bust_in_silhouette: Reply From: max.marauder

Function is_action_pressed() expects a string, if ui_select is the name of your action, you have to do:


The way you did it (without quotes) would work if ui_select was a name of a variable that you defined somewhere in the code.

I tried doing that but instead it gave me this error:

Edit: I realized that I forgot to add the actual true/false statement, here’s the updated img. Still have an error even if it’s different tho.

enter image description here

Edit 2: I figured it out by looking at a code example, thank you!

Extenos | 2022-08-05 18:26