Custom Pickup
it may not work on UE 5.2 and above. Click to show new Dynamic Combat System Documentation
How to extend BP_PickupActor to make it display stored item / custom mesh / particle.
What I'm gonna do, is to make BP_PickupActor as base class, and make few children out of it which will be customizable.
Modify F_Item struct by adding static mesh variable which will be its world representation.
It's recommended to restart editor at this point and check whether values of item object blueprints were not reseted (Blueprints/Items/ObjectItems), if so, set them back manually.
Go through all blueprint items and set WorldMesh variable.
Great Sword example.
Remove all but scene components from BP_PickupActor.
Mark this class as Abstract in ClassSettings, it will unable to drop this Actor into the world.
Create few children of BP_PickupActor.
- BP_PickupActor_CustomMesh - will allow to set any static mesh.
- BP_PickupActor_Light - will be displaying light particle.
- BP_PickupActor_StoredItem - will be showing mesh of stored item.
Firstly Modify BP_PickupActor_Light.
It should look exacly as BP_PickupActor before changes.
Add box collider and particle system (set particle to P_Soul).
Change collision type of Box to Interactable, so player will be able to interact with it.
Now let's modify BP_PickupActor_CustomMesh.
Add static mesh and same box as in previous blueprint (remember to set its collision type to Interactable).
In construction script set static mesh of component and promote new mesh to variable.
Mark new variable as InstanceEditable and ExposeOnSpawn.
Finally let's modify BP_PickupActor_StoredItem which will be displaying stored item.
Add billboard component (it will allow to select blueprint easier in the editor), static mesh component and box collider (remember to set its collision type to Interactable)
Add new function UpdateStaticMesh and call it on BeginPlay.
Before we test these blueprints, let's modify Drop function in InventoryComponent.
Remove upper graph and change spawn class to BP_PickupActor_StoredItem.
(you could also leave upper graph and change class to BP_PickupActor_Light so items will still be gathering in 1 pickup actor on drop)
Now we can test new pickup actors.