I can't delete the created widget

BP code:

Hello, I am writing from a translator, so please excuse any mistakes :slight_smile:

I create a Widget Component for the selected Actor, but when I click it again I want to delete it, but it is not removed(. As I understand it, this is because of a different owner, and I can’t delete it from the main BP, but I can’t change the owner.

Help

u need to save the ref of the widget in a variable after the “Add Widget component” and use that variable to destroy the component, anyways i believe is better create the widget in begin play, save de ref in a var and just turn the visibility when u use it :face_in_clouds:

Just to clarify, you set the input of DestroyComponent from the output of a node that is not executing in that path. Note how the branch’s white lines goes in two separate ways? You can’t use nodes from one branch in another branch unless they have no white execution pins. So the DestroyComponent node isn’t going to do anything. It’s as if it isn’t there. And don’t try to make it execute as that would just create a new component and delete that while doing nothing to the original component.

As the other response said, you need to store the component in a variable. That way, when the other branch is run at a later time, it will have a reference to the component.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.