Skip to content
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

Enumerators in structs doesn't send Enum value or name #98

Closed
taiven opened this issue Sep 28, 2018 · 4 comments
Closed

Enumerators in structs doesn't send Enum value or name #98

taiven opened this issue Sep 28, 2018 · 4 comments

Comments

@taiven
Copy link

taiven commented Sep 28, 2018

When dumping a simple chat struct I made that happens to have an Enumeration for channels I got this instead of the actual value.

image

This is the blueprint code

image

This is my first ever issue on github. :) So feel free to let me know if I completely butchered it.

@getnamo
Copy link
Owner

getnamo commented Oct 1, 2018

Issue is great, thanks for spotting the bug. It appears enums do not auto-convert correctly, but there is a way to get string format of an UEnum in C++, so there should be a way to add support for this. I'm unsure if there is an easy way to do the reverse (json->enum field fill).

Marking this as an enhancement. In meantime for a workaround I'd suggest making the field a string field and doing enum->string conversion in blueprint instead.

@getnamo
Copy link
Owner

getnamo commented Aug 7, 2019

Merged outgoing workaround for enums in: b911415.

Getting the other way to work requires a lot of re-writes to update
https://github.com/EpicGames/UnrealEngine/blob/release/Engine/Source/Runtime/JsonUtilities/Private/JsonObjectConverter.cpp#L377 case (~6-8 functions) or ideally would have an engine pull request merged in which based on history takes forever.

@getnamo
Copy link
Owner

getnamo commented Aug 7, 2019

Other direction supported in f58c0f0.

This now brings full support for Enums in Structs. Note that when changing the enum value in javascript, the case doesn't matter, e.g. 'Good' enum will correctly fill from a js value of 'good' or 'Good', but if your string doesn't match e.g. a missing letter 'god' it will throw an error in the log and stop the rest of the JSON parse.

Awaiting other fixes before release.

@getnamo
Copy link
Owner

getnamo commented Sep 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants