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"

Widget is Adding Itself Over and Over and Giving Error

I have the Use_Item widget and it is working wonderfully. I have it set to, on Construct, set a variable that if the base has no tower says "Hold E to Customize this Empty Base", otherwise says "Hold E to Customize [Tower Name] at [Base Name] Base". My issue arises during testing. I test and get the use item screen to appear and disappear by both looking at the Base and away, and by opening the Base's menu and closing it. On end play, it gives me 2 warnings with yellow "!" next to them that say "The widget "Use_Item_C" was already added to the screen."

The BP is a bit elaborate to show in pictures, but basically it does a line trace every frame at a distance of 420uu/cm, and if it hits a buildable it runs the script to see if there is a tower or not and adds the use widget. In the BP code, if the widget is in the viewport, but the player is not focussed on it it removes the UI, but if the player is focussed on it and it is hidden, it will add it. It runs both the "Is Valid" and "Is In Viewport" nodes on a variable called "UI: Pickup" (set on widget Creation and set to null after destroying widget) before adding the widget to the viewport, and in fact I have now connected all pins that used to lead to "Add to Viewport", to the Branch node with the Valid and In Viewport checker. I have checked over and over and this is the only place that adds this widget to the screen. On top of that, I have had the engine print "Hello" when "Add to Viewport" is called, and it only added it when I wanted and I got no extra "Hello" that should not have been there. Even then, it gives me the warnings. Anyone know what might be going on? I don't want this to cause any issues or cause bugs in the release.

Below are a few pics that may help explain.

These are the warnings I am getting. Warnings

This is where is decides whether to add or remove the Use Item UI from the viewport. Adding and Removing from Viewport

This is where it decides what the Text that the player sees should be. Setting the Displayed Text

This is my script for all of the pins to lead to that checks to ensure that the widget is not in the screen before adding, and also shows the variable that I use. Add to Viewport BP Script

Product Version: UE 4.19
add-to-viewport.png (282.6 kB)
warnings.png (71.8 kB)
two-worlds.png (352.6 kB)
set-text.png (288.0 kB)
more ▼

asked Apr 26 '18 at 05:37 AM in Blueprint Scripting

avatar image

130 4 6 7

avatar image Pouia Pouia Feb 17 '19 at 06:30 PM

Did you found a solution ?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

It seems that you are creating the widget every time. You do not need to do that. Do this to save a reference to the widget the first time it is created. Only one instance of the widget will be created. Which is nice.

alt text

cheers podge

more ▼

answered Apr 06 '19 at 12:36 PM

avatar image

246 4 7 13

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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