problems using UENUM with enums defined in third party code

I have a third party library that I am trying to wrap in a plugin and expose to unreal. The library contains several plain C++ enums, and I want these to be visible in blueprint. Whilst I can create my own enums with the UENUM() macro, is there an alternative approach for using UENUM with an existing enum?

I have tried creating unreal specific enums and converting between the two, but this approach leaves a lot of tightly coupled enum redefinitions in the plugin.

I just wanted to know if anyone knows of a cleaner way of doing this?

There isn’t no. If you want them to be Blueprint visible, you must mirror them with UENUM().

Not directly no.

What you could try is to have your own custom replica of that enum. And use a function to change it instead. The function sees what you want and modifies that original as well:

//This is the enum that was in the class
enum EOriginalEnum

//This is the one you create
enum ECustomEnum : uint8

//In your class implementation

//Presummable this would be in the third party class - can make your own if you want
FOriginalEnum OriginalEnumVar;

//The variable to store the value for your enum (you don't need this here, unless you actually want to store the value of the custom one as well - I put this here to demonstrate the TEnumAsByte)
TEnumAsByte<ECustomEnum> MyCustomEnum;

void ChangeEnumType(TEnumAsByte<ECustomEnum> NewEnum);

//In your cpp file

void MyClass::ChangeEnumType(TEnumAsByte<ECustomEnum> NewEnum)
    //I forgot exactly how you do this, so you're probably going to get an error here, but whatever it is, is very similar to this.
    //Also you would do this if you wanted to store the custom one as well: MyCustomEnum = NewEnum;

    OriginalEnumVar = (EOriginalEnum)NewEnum;

Good luck!

Edit: Forgot to mention: It is important that the Original Enum and the Custom Enum have the same order which corresponds to the same thing. This is because, we are simply casting the numerical value of the enum to the numerical value of the other enum. If they are different, you are going to get runtime errors