I’m trying to separate mobile and desktop inputs… but this keeps returning true even when I print out the os_name and clearly shows they’re different.
The combination of ==
and or
doesn’t work the way you intended it to. The or
needs a bool on both of its sides. The left bool is os_name == "Android"
, and the right one is "iOS"
, which gives true
when cast to a bool.
I think your if
statement should be:
if os_name == "Android" or os_name == "iOS":
You are indeed correct. Still adjusting to GDscript. This logic was valid in C#.
Thanks!
You’re welcome, glad I could help.
If you have a working version of the C# expression somewhere, I’d be interested in seeing that. It must have been at least a bit different (maybe array membership test), as the oeprator priorities should be pretty similar (but it should complain about the type mismatch, I suppose).
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.