Download

"Is in Viewport" Error. (Displaying widget to screen) Works! just a worrisome error.

Hey, how’s everyone doing?
I hope you’re having a good weekend.

I’ve been studying by myself with the wonderful internet to help me out with blueprints, but I’m finally stumped!

(“Button true/false” also counts as overlap true/false. bad coding, I know, but this was just a concept.)

This code that I have displays the “MyText” widget to the screen when I press the “T” key inside the box trigger. It also makes the Widget disappear when I move off the box trigger.

The problem I was having, was that the flip flop node required two presses on the second try, if I left while the text was being shown.
To fix this, I used the “Is in Viewport” node, and it worked!

Everything works flawlessly! However I get this error every time I use the button.

is there anything I should be worried about? Was there a better way I could have done this?

Thanks for any and all help!

If the Button False event is called before the widget is created, it will remove the widget from viewport. But it is not created yet, so it accesses none.
Same goes for the branch, it checks if the widget is in viewport, but accesses none.
You would probably want to use a is valid check to see if it is valid.
Though to be honest, the way I would do it is to create the widget elsewhere and store a reference of it, which you check if it is in viewport like you are doing now.

Alright guys, I hate to say it but I just can’t seem to get it.
I’ve been at it for hours and hours, but nothing seems to work the way I want it to other than my default, however I believe it’s because I can’t get a reference, which I’ll get to.
Just so we’re on the same page, here’s the setup that I keep returning to:

(The “is valids” are floating harmlessly. I can’t figure out how to hook those into this project for the life of me that gives me the result I want. I believe the key is just re-ordering my nodes)

I did try placing the “create X widget” node in my “Button” logic as seen here: http://i.imgur.com/blGCq8s.png
Which is what I think you meant when you recommended creating it elsewhere.
But I can’t for the life of me figure out how to reference my “MyText” widget.

I also tried re-arranging the node so it gets created before the branch, as seen here: http://i.imgur.com/PySzhox.png
However, this only outputs false (Which is add to viewport)

Am I wrong in thinking this can all be fixed if I could just get a reference to the “MyText” Widget? Maybe I’m trying something wrong, but I can’t seem to get that reference no matter what I do.

I really appreciate the help by the way. Any help getting this solved is greatly appreciated.

Right click the Return value on the Create My Text Widget node and create a variable. Use that to check is valid and anything else that you wish to do with the widget in question. It frees up your blueprint from lines going going everywhere and makes your code more readable, which can lead to less mistakes.

  • The “create information window” function is called on the begin play event. So we know it is created, so we don’t really need the is valid check.
  • We store it in a variable so we can reference it later. To do so, it needs to be of the same widget class type. You can right click the return value and create variable. Or in the variable type search for “My text”. It should be a reference, not class.
  • Now we check the reference if it is in viewport.

That’s how I would do it, which I realize is not exactly how you do it at the moment. If you insist on creating the widget after the branch, setting the reference is similar enough but then you really should check the reference if it is valid before the is in viewport check.

@Ste1nar You’re an absolute godsend, everything works. I’m marking this as solved!
I had multiple “Create MyText Widget” all over the place for different projects. turning them into one variable and setting up the nodes the way you have fixed everything

I do have one question though, won’t there be repercussions if I make all my widgets created on start? What’s the gold standard I should be aiming for with widget creation?

again guys, absolute godsend. I can’t believe I didn’t figure this out myself, especially since I already have a pretty good grounding in c++. However I’ve been using the world outliner and right clicking on the graph to create my references.

I really appreciate it. Solved.