You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
StringName objects won't be found inArrays (but it does work for Dictionaries):
if StringName("test") == "test":
print("works")
if StringName("test") == in {test=true}:
print("works")
# BUG
if StringName("test") in ["test"]:
print("doesn't work")
# BUG
if node.name in ["A", "B"]:
print("never printed, even is node is named A or B")
Steps to reproduce
Write and run the simple script I presented above.
Minimal reproduction project
See above.
The text was updated successfully, but these errors were encountered:
mrimvo
changed the title
Godot 4 StringName not working with "in" operator
Godot 4 StringName not found in Array
Nov 20, 2022
Unfortunately this is as much of a bug as an int and a float in an Array being two completely different Variant types. Same goes for Vector2 and Vector2i, and so on. If finding Variants in Arrays were to be loose, it'd be much, much slower.
One solution would be to at least make it opt-in. Maybe an optional parameter in Array.has()?
Don't worry I hate StringNames' practical implementation too
Godot version
4.0 Beta 4
System information
Ubuntu 20.04
Issue description
StringName objects won't be found in Arrays (but it does work for Dictionaries):
Steps to reproduce
Write and run the simple script I presented above.
Minimal reproduction project
See above.
The text was updated successfully, but these errors were encountered: