-
-
Notifications
You must be signed in to change notification settings - Fork 21k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C#: Can't compare ButtonIndex property (int) to ButtonList enum value, e.g. ButtonList.Left #41552
Comments
I'm not sure it's a bug, C# probably doesn't auto-cast enum types to int, and if (buttonEvent.ButtonIndex.Equals(1)) GD.Print("Mouse Button Pressed Using 1");
if (((ButtonList)buttonEvent.ButtonIndex).Equals(ButtonList.Left)) GD.Print("Mouse Button Pressed Using ButtonList (cast as enum)");
if (buttonEvent.ButtonIndex.Equals((int)ButtonList.Left)) GD.Print("Mouse Button Pressed Using ButtonList (cast to int)"); I agree that it's not the best UX wise, but I'm not sure how this can be solved in C#. CC @neikeq |
Can |
This was going to be fixed by #27450. It's pending being salvaged by @aaronfranke. Unless he can't work on it anymore, in which case I would take care of it at some point before 4.0. |
@aaronfranke Yeah, no hurries. 4.0 is still far. |
This was implemented by #47378 |
Godot version: 3.2.2.stable.mono.official
OS/device including version: Windows 10
Issue description:
I wrote C# code to catch the
_Input
event, then checked for multiple clicks by first casting toInputEventMouseButton
with theis
keyword, then checking if theInputEventMouseButton
'sButtonIndex.Equals(ButtonList.Left)
. This never was true. However, upon replacing theButtonList.Left
with simply1
, it works perfectly. I find this strange as it works with (for example)WheelUp
andWheelDown
.Steps to reproduce: Please simply download below, run, and observe the debugging output! My code is also written below:
Minimal reproduction project:
MinimalExampleForButtonListIssue.zip
The text was updated successfully, but these errors were encountered: