I am actually trying to learn to make clean blueprint menus on several projects but I have the same problem each times. I am using the manuel method here : https://docs.unrealengine.com/latest/INT/Engine/UMG/QuickStart/4/index.html.
My problem is the main menu does not disappear after the “play” button is clicked and after the level is loaded, it just stays here and I can move the character. It quite bother me since blueprint have done wonder for me until now. I have checked and re-checked can not figure the problem.
Here is my main menu blueprint : http://imgur.com/LPPi3cl
The Level blueprint : http://imgur.com/cKE8Kln
Can someone see the problem ?
Thanks in advance.
Set input mode - Thats the guy you want to look for. The reason why they aren’t hiding im not sure, I can’t read the blueprint pictures very well but the visibility hidden on the outside layer of the UMG should work.
Well, without better images (talking about what they show, not quality but increase it will be great) we can only speculate:
- Are you 100% sure that the events that call the visible and hidden states are correct? Check it with a print string inside
- Where and How are you setting the value for “Main Menu” and “Option Menu”? What kind of those are?
Im pretty sure its still visible because you call f.e. open level before remove from parent.
When opening a level most of your game will recall the initialization process.
And even your widget will be reset to null but its still in the rendering loop in your hud so you still see it.
So what you need to to is to remove the widget from viewport before you open the level.
One problem you have with that is that you dont store a reference to your widget after creating it in LvlBP.
Note: Fmpov its good habit to create and destroy thing in the same class.
I believe in LvlBP there should also be an Event called “EndPlay”.
So try this:
In LvlBP -> Create a reference variable of your WidgetClass.
In LvlBP/BeginPlay -> after calling create Widget drag the output into your variable.
In LvlBP/EndPlay -> get the variable (check if its valid) and the call Remove from Parent/Viewport (whatever).
Btw. i like to be explicit so i always give a PlayerController to the Node “CreateWidget”. I dont even know if Owning Player is valid in LevelBP, at last it confuses me, because a Player “owns” a Level sounds strange
You can delete your widget when you open a new level.