-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Fixed enum to wrong string cause by misuse GetNameStringByValue and GetNameStringByIndex #4817
base: dev
Are you sure you want to change the base?
Conversation
…etNameStringByIndex
Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would update our CHANGELOG.md based on your changes. |
Hi Julee, Regards |
No, you can't assume the enum index is the enum value, because enum value can assign to any value! Check the QualityLevelUE.h: UENUM(BlueprintType)
enum class EQualityLevel : uint8
{
Null = 0, // Workarround for UE4.24 issue with enums
Low = CARLA_ENUM_FROM_RPC(Low) UMETA(DisplayName = "Low"),
// Medium = CARLA_ENUM_FROM_RPC(Medium) UMETA(DisplayName = "Medium"),
// High = CARLA_ENUM_FROM_RPC(High) UMETA(DisplayName = "High"),
Epic = CARLA_ENUM_FROM_RPC(Epic) UMETA(DisplayName = "Epic"),
SIZE UMETA(Hidden),
INVALID UMETA(Hidden)
}; We can see enum index is not the with enum value ( EQualityLevel::Low index is 1, but the enum value is 0). Unreal Engine documentation also pointed out the issue:
You say:
This is just according whether the enum is defined to 64 bits int or not, if not, cast to int32_t doesn't matter. Unreal give the parameter with int64_t is because the enum can be defined to 64 bits int, it must support all enum definitions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This bug should be fixed |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This change is