Is it possible to create new UClass at runtime (after game has been packaged) ?

My scenario is simple. I have items, which can be customized. Each base item type is separate blueprint. Each item have array of Item Upgrades (UObject based blueprints), which can modify item in various ways.

Now I store items as UClass (in player inventory). And spawn the when needed.
But now lets say player will add item upgrades to default item. When player does it, I’d like to save new item as UClass (Blueprint?), for further use, to spawn new item when needed.

Short version:

  1. Player Pick item -> Item is spawned -> Player add upgrades to item -> I want to save item with upgrades as new UClass, I don’t want to serialize spawned item to disk, only save it “blueprint”/

No this isn’t possible, but to be honest I think you’re also going about it the wrong way. Why save it as a new class at all, why can it not just be an item with an associated upgrade? Create your own spawn function to handle appending the upgrade when you spawn it.

Construct your class so you have values you can adjust at runtime to well… raise its strenght value or whatever or make a new array from a custom structure where you can add upgrades in stackform

Right. But how do I determine which upgrade happen to be attached to said item, without saving some data about item in first place ?
I wanted to use UClasses for it, because they are small and provide CDO for easy access to informations.

Well, I probably could wrap it into some other class/struct like item info, which would be serialized to disk and which would contain references to item blueprint, upgrades blueprint etc.

But this would make harder to access information about referenced blueprints CDO, and CDOs are nice for getting information about particular object without constructing it.

Well it is option, but… It’s not what I want. I don’t want set of predefined adjustments per item, as it defeats my idea of customization. The point is to have items with upgrades slots, and each upgrade slot player can add any fitting upgrade. The point with upgrades is they are not flat increases of some numbers, but event handlers. They listen for player actions, and perform another action.

Then you have state inherent to your items that needs to be preserved.

Either store them in your inventory as instances instead of classes, or store the added state separately so you can reapply it whenever you spawn the item.

no you didnt understand. Each array element has for example a str,agi,dex,mana etc all those stacks get summed up in the end. You could add or remove at runtime