Hi all,
If I have a simple POD class like such:
UCLASS(Blueprintable)
class USimplePod : public UObject
{
GeneratedBody()
public:
int32 GetMySimpleVar() const { return MySimpleVar; }
protected:
UPROPERTY()
int32 MySimpleVar;
};
And I have a custom C++ Blueprint object (inherits from UBlueprint, has a custom factory, etc) that has USimplePod as the Parent Class. How would I access/modify the members of the Parent Class from the Blueprint object?
The only answer I found was to do something like:
USimplePod* MyPod = Cast<USimplePod>(MyBlueprint->ParentClass->GetDefaultObject());
// Set the members, etc.
But, if I understand things correctly (which might be a stretch), wouldn’t that just be editing the Class Default Object of the Parent Class (in this case, USimplePod)? Beyond that editting the CDO sounds like a terrible idea, I could have N number of these BPs so they each need their own “copy” of Parent Class members they can customize, etc. The ParentClass is just data, no runtime craziness so I believe this should be totally possible.
Any thoughts?
EDIT: I figured it out. What I wanted was the CDO of the GeneratedClass and not the ParentClass. Cheers!