UMG When I try the more convenient binding property
My design is to allow a UMG to set an ObjectClass, and then bind to the properties of this Object in UMG. But I must use UObject in Cpp to hold any subclasses
At this time, even if Object is a subclass, the editor will treat it as Object. After reading the relevant source code, I determined that the editor only relies on the FObjectProperty->PropertyClass corresponding to the Object to determine the class of the Object, so I wrote the following code.
I made sure that the class of Object was indeed ObjectClass, otherwise there would be a fatal error, so I got the following effect, and everything worked fine when it was running.
Although this is really convenient, my approach is still dangerous. If this result is good, we should support this function in the source code.
Posted Jun 3, 2025, 7:35 AM UTC