Announcement

Collapse
No announcement yet.

Using UObjects instead of structs and components

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Using UObjects instead of structs and components

    The TLDR:
    UObjects in the details panel don't show anything, just "None"
    Construct object from class blueprint doesn't work for UObjects and derived types



    Details:
    I'm experimenting with using UObjects as the base class for all of my game items. The type is Item_Base, deriving from UObject. These are all stored in the GameMode on the server, in a MAP where the key is an integer ID.
    On the server, if an actor is created, the actor has an Item_Base variable referencing the original. Same for inventories on the server. If the client needs the inventory info or other data, it gets sent a quick and dirty struct containing the needed information.

    I like this system so far, because everybody just has the reference to the central item. On the server, no need to pass around a bunch of structs.

    The big downside that I can see has to do with the details panel. If you want to examine say...a chest, the Item_Base doesn't show any values or anything. It looks like an empty, uninitialized object.

    I don't know how unreal handles showing UObject data in details, maybe using reflection, serialization or whatever. But to me, UObjects are perfect for this situation since they give more functionality than structs, but are leaner than components.

    Should I just fold and use components instead, even though I don't need the extra functionality? I don't see any benefit from going back to structs.

    Also, I'd like to be able to construct a uobject give the class, but that doesn't work...seems like you an only execute that if you give it an actor. I don't understand the rational behind this either. Others have reported this, and the only answer is to create some C++.


    #2
    Does anyone have any thoughts on showing UObject details (or do I need to create a custom view, via C++)?
    Also, would anyone be willing to offer their thoughts on using UObjects in this way, for game items?

    Comment

    Working...
    X