UObject vs UStruct vs An Alternative?

22u_79
Sun, 25 Apr 2021 19:48:17 +0000
Community & Industry Discussion

I am currently trying to basically make my own type of variable, in form of a class. It is meant to store the in-game stats of actors of any kind. Like for example Health, Speed, or maybe just the Damage or Mana-Cost of an ability. The idea is, that functionality for complex interactions between different stats (Eg if the damage-Stat of an attack scales with the strengh-stat of the attacker) is in the class behind closed doors, so that it becomes very easy to introduce new interactions in later stages, and for readability. I have tried using UObjects as the parent class, but the problem with that is, that they can’t be replicated easily and from my knowledge I can’t just treat them like variables. Through further research I came across UStructs, but the problem with them is that they don’t allow for me to include a multitude of complex UFunctions. I’d like to keep the hole class private, apart from a few getter and setter functions, for the reasons stated above. AActors seem like a huge waste, since they contain so much more unneeded functionality and all I want this class to be is a more complex variable. So my question is:

Is here either a good alternative, or a reliable way of making my ideas work within an UObject or UStruct? One that can be replicated, treated as a UPROPERTY-variable and can contain complex, isolated functionality?

10 posts - 1 participant