Change class of an asset object created by factory

Hi,

Let’s say I have these classes:

  • InventoryItem
  • –WeaponItem
  • –ConsumableItem
  • ----AmmoItem
  • ----HealthItem

InventoryItem is the parent class of weaponItem and consumableItem. ConsumableItem is the parent of AmmoItem and HealthItem.

I created Factories for each one of them, so I can go right click->Create Advanced asset and select any of them.

But, once I created several asset objects, can I change the class? if I created a plain InventoryItem asset can I modify it so it’s a WeaponItem or an AmmoItem?

I’m not entirely sure if I understood what you meant, but you can reparent the blueprint assets under “class settings” in the BP.
If you have subclasses of a class, like InventoryItem, you actually only need a single factory class with a classpicker
here’s an example https://kasundevblog.wordpress.com/2015/10/07/creating-assets-with-support-of-a-custom-class-picker-unreal-engine-4/
But having one for each is perfectly fine too

Sorry for not explaining myself correctly. Thanks very much for you reply.

What I wanted is a feature like the one you described for blueprints but for “asset objects”. As you know, you can open any blueprint and re-assign a parent class under class settings, but there’s no such a thing inside the “asset objets” editor.

Having the picker in the constructor is cool but doesn’t address my problem. That’s for construction time not when the asset is already created.

I’ll try to explain myself again, I have a lot of “asset objects” that are BaseItems already created with the parent class, not the children (Weapon, Ammo… etc), and I would like to modify the class to point to the correct one.

I think I found an ugly solution, haven’t had the time to test it, though

  1. Migrate all the assets that will be of the same child class to a new project with the same C++ files but no content.
  2. Modify “+ActiveClassRedirects” in Config/DefaultEngine.ini to point from the parent to the child
  3. Migrate them back in the original project
  4. Repeat for each subclass individually deleting the +ActiveClassRedirects each time

Thanks very much!

oh you’re right, there is no class settings on assets. I was sure they had the normal BP menu, i should have checked. My bad.