Removing Static Mesh Component from Player Character

I currently have a system to put hats and other cosmetics on the player character by attaching a new mesh to a socket on the Player Character when activated by a trigger.


These are the modules I’m using to do this.

When wanting to swap a hat for instance that goes on the same socket, how can I remove that old hat so the new one is not clipping on the old one?
These are currently set on separate blueprints (each blueprint is a set of items that attach and swap the player’s appearance at once), is it possible to remove a component that is attached to the Hat Socket?

I can do my best to explain further, and any help is appreciated.

Hey @dubthedubmeister!

After adding the Mesh Component, you can right click “Return Value” and “Promote to Variable”, renaming something like “Current Hat”. Then, you can do anything with it using “Get Current Hat” and it will grab that static mesh for your use!

Before adding the NEW hat, check if “Current Hat” is Valid (Get, right click it, “convert to validated Get”) and if it’s valid, Destroy it. If it’s NOT VALID, that means there isn’t a hat to destroy, so proceed normally. :slight_smile: This is to prevent a Null Reference (and therefore prevent crashing).

Hope that helps! :slight_smile:

I turned the Return Value into a Variable, but I can’t convert the “Get” node into a “Validated Get.” I’ve looked it up and I see that it should be right there in the right click drop down but I don’t see it.