I am building an elevator and as of now it takes keyboard inputs to determine which floor it goes to (click “2” and it goes to the second floor, etc.). However, I want to change it so that once the player enters the elevator, a widget pops up on which are numbered buttons and the player would be able to just click on the buttons in order to control the elevator.
Could anyone tell me how I can do this? (I am a bit new to the program so I would definitely appreciate a detailed response thank you!)
My recommendation is to create a variable called ElevatorReference in the widget
It could be of type actor or if you want to be more precise you can use your elevator class.
When you create the widget in the elevator class (create widget from class) save the widget as variable and then drag from its output and set ElevatorReference to self
During BeginPlay you create the widget and save it as variable, then set it’s parameter “ElevatorReference” to self
During BeginOverlap you add the widget to viewport
During EndOverlap you remove it from parent
Use a function with a parameter so you can easily call it from an external BP
(I don’t know what your “Floor button” float parameter is, maybe you meant bottom?)