x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Can you cleanly store Remove from Parent inside of a function?

https://i.imgur.com/nOAOgNE.png

I have a UI element that needs to disappear every time the player leaves combat. Normally when I need something to happen during the end of combat I stick it in the OutOfCombat function that you can see highlighted. This is useful because there are multiple ways to leave combat.

Now that I've added a UI element that needs to vanish I'm having problems. The setup that is screenshotted lets me remove the UI element whenever combat is manually ended. However, if the player sprints, or crouches, etc to exit combat the UI element remains. I tried to stick the "remove from parent" node inside the "OutOfCombat" function but that doesn't seem to work. Is there an easy way for me to put the remove from parent node inside of the function? The alternative seems to be manually adding the remove node to each instance of out combat which defeats the purpose of having a function in the first place.

Product Version: UE 4.20
Tags:
more ▼

asked Oct 18 '18 at 05:19 AM in Blueprint Scripting

avatar image

Lazy_Lifeguard
8 1 2 4

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

It should work as is. Two notes:

  • ensure you store the reference to the widget you remove from parent - otherwise you'll have it garbage collected and will need to recreate and re-add the widget

  • alternatively, consider not removing it from parent and hide it instead (or collapse if you need something else to occupy the same space in the hierarchy)

more ▼

answered Oct 18 '18 at 06:49 AM

avatar image

Everynone
12.5k 72 24 51

avatar image Lazy_Lifeguard Oct 18 '18 at 06:29 PM

Thank you! I wasn't storing the widget which was my main problem. Now that it's a variable I can reference it easily inside of the out of combat function. I'm also collapsing it which helps. For anyone who gets here and needs to know what the hide node is, I'm using SetVisibility which is plugged into my widget variable.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question