-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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#: Array.Contains() doesn't work properly with enums #98595
Comments
I couldn't reproduce this on 61accf0, potentially it's been fixed between dev3 and that commit. For that commit, cs_array_contains.zip has the output:
|
Were you able to reproduce it on normap 4.4 dev3 though? |
I could not reproduce it on 4.4 dev3 either; the output is the same as the current head. If you're certain this is an engine bug and not a project bug, can you compare your code to the zipped project I linked and make an MRP? |
Sounds like a duplicate of #98309. Make sure the array property is typed when serialized to the scene, it should look like: |
Ah interesting, thanks for linking that. Yeah that seems to trigger specifically for int arrays and the value [Export] Array<MyEnum> enumArray = new();
[Export] Array<int> intArray = new(); the output changes to
|
Doing |
they're referring to how the array is serialized by the resource/scene. For example, in the example project I linked above,
|
The array is already set to another value in this function, which is called in an Initialize() function of the ItemManager |
A workaround I found was just using |
Can someone add the confirmed label? |
Tested versions
4.4.dev3
System information
Windows 11 - Godot 4.4.dev3
Issue description
I have an enum called
ItemType
, belonging to a custom resource calledItemManager
:When I try to check if an
Array<ItemType>
contains STATS from this enum, unexpected behavior happens:Steps to reproduce
Minimal reproduction project (MRP)
N/A
The text was updated successfully, but these errors were encountered: