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"

How do I make UI work after respawning?

I'm making a multiplayer mobile game where my UI is created on the player controller because I wanted to be able to use the same UI when my player respawns with the same or another character. Now the thing is that when I respawn ,the UI won't even receive input . I think the problem is tied with the way I'm respawning the player which I'm using the destroy actor node. I would have easily fixed my problem if there was a destroy widget node but that's not the case . I'm not really sure why this happens but it happens when he respawns because when the player starts the match it all works fine. And I also want to keep using destroy actor if that's possible since it fixes some problems by itself with the character.

Would really appreciate help

Product Version: UE 4.18
Tags:
more ▼

asked Jan 09 '18 at 05:51 PM in Blueprint Scripting

avatar image

Ace7806
15 2 3 8

avatar image ThompsonN13 Jan 09 '18 at 11:05 PM

the widget is probably reading values from your character yes? so it may just be that its reference needs updating to the new character that is created. I'm not sure how that would happen but couldn't you remove the widget from the viewport when the player dies then construct a new one so that it automatically references the new character.

avatar image Ace7806 Jan 09 '18 at 11:32 PM

The widget does have a player character reference but it's being updated that I'm sure, but the UI won't receive input. I could remove the widget and create a new one but I think that the old widget stays in memory so it's not very efficient.

avatar image Ace7806 Jan 10 '18 at 05:30 PM

I think it may have to do something way it's ownership but I'm not sure

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

1 answer: sort voted first

You could SetUserFocus on the widget, or RemoveFromParent to "destroy" it and create a new one. One of these should do the trick.

more ▼

answered Jan 10 '18 at 08:45 PM

avatar image

blkhouse_vlucki
185 5 7 14

avatar image Ace7806 Jan 10 '18 at 11:40 PM

Hmmm but does remove from parent actually destroys it ? As in removed it from memory completely? Also setUserFocus didn't work

avatar image Ace7806 Jan 10 '18 at 11:53 PM

Welp removing the parent and making a new widget solved the input problem but I'm scared that it's gonna be a problem on the memory side of things , that's if garbage collection doesn't take care of it

(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