Skeletal Mesh not setting properly


Screenshot 2025-02-24 173445



Hello Everyone,
I’ve been trying to solve this bug for awhile now. I can correctly set my character’s skeletal mesh component but when UnEquipping the item, the data correctly sets to null but then repopulates with the item’s data unprompted. I have Logs throughout my cpp so I’m sure I’m not resetting it there. I’ve included the OnDrop function from the equipment widget, the equip and unequip from the inventory and then the equip and unquip functions for the character.

One thing I noticed is that you are not clearing the skeletal or static mesh during the unequip process.

I think the inventory system has too much responsibility at this point. I would make an equipment component that should encapsulate the equipping / unequipping functions.

Instead of doing two functions for skeletal and static meshes pass in a common UMeshcomponent pointer and do the logic inside of it.

Personally I’d just have an equip function that would clear the slot / unequip mesh and logic if a null prointer is passed in. 1 function easy to understand.

I tried using a TMap to clear meshes according to each slot but was getting this same issue so I reverted back to directly calling variables on the character. The inventory calls the UnEquip function on the character which handles the meshes. The inventory just clears the data which works well, it’s just the UnEquip functions on the character don’t work properly even though the meshes are direct variables on the character that the character is setting to null. It works for a split moment but then reverts back even though no remaining parts of the code handle the mesh. Even if it did, the Logs would trigger which makes it even more perplexing

I noticed on the end of the drag and drop operation you call reset visuals.

If you have a separate unequip function then you might need to call it before your equip function and store it for the swap to the current held item.

Ssme thing goes if your are dropping somthing on the ground or in another inv slot it should become unequiped on the drop.

The Inventory was getting the owner during construction and the player character was not fully created so that function was failing. Once GetOwner was moved to BeginPlay, it started working correctly.