Download

How can I add new variables to UObject?

I want to add a variable to the UObject class, is that possible?
I realize I can declare my variable in a UObject Child Class, and make that class the parent of all my UObject derived classes. However the problem with that, is I need the UObject extension to affect actors, aswell as plain UObjects.

Can you? Sure, the source for the engine is available and you can edit it however you want if you’re willing and feeling spicy enough.

Should you? Probably not, but it’s hard to say definitively without knowing more details about what you’re trying to extend it to do. Maybe it’s okay for it to be in a common derivation of UObject and then use a component for Actors instead. Maybe what you really want is an interface.

mm, well this is my usecase:
I Wanted to declare this variable in UObjects:
PropertyOwners TMap<FName, UPlayer*>;

The reason behind it:
I have widgets that let the player modify object UProperty values at runtime.

I want to record which player is responsible for modifying which value of any object, that is what the aforementioned TMap is for.

Looks like XY problem

1 Like