Line trace by channel show widget
Hi. I'm trying to interact with an object using line trace by channel but first I want to show a widget with a button for interaction. The problem is that when I'm over an object line trace is firing multiple times and my widget is created as long as I stay over the object. I'm using BP interface, so in my FPSChar BP I have this:
Here is my object, which is a door. Here I don't know how to stop creating multiple times the widget. And after I hover out the object, the widget should be removed from viewport.
This is how is working now. ( Widget created multiple times )
How can I show the widget only once if I'm over the specific object and to be visible until I press the widget button or I hover out the object. Thank you!
asked Jan 10 '19 at 12:52 AM in Blueprint Scripting
why not just use overlap events? it seems like your just trying to show the widget when your overlapping the actor so using overlap events would be logical. you would just need to have on begin overlap, then a bit of flow control to make sure its the player, then the creation of the widget and set a variable reference to the widget created. then on end overlap you see if the variable is still valid, if it is valid then you destroy it, if its not valid then youve already destroyed it by clicking the button. its pretty simple and theres a example script posted below. it will also perform better this way since it doesnt rely on tick.
Follow this question
Once you sign in you will be able to subscribe for any updates here