How do I show the crosshair or health bar on the screen after loading the widget? Please help.
You can use the node “add to viewport”
I tried to do that and when my loading widget was loaded, nothing appeared during the game
How do you load the widget?
You need to use the node “create widget” an after that you can plug the output into the node "add to viewport.
You see? Did not work
Ah ok, you want to show another widget after this widget, right?
Yes, to show a different widget that will be displayed during the game
It is that case because you are trying to load the crosshair and the healthbar after the new level opens.
If you open a new level your loading widget get destroyed and the code after the level wont execute.
what should I do?
So you have to use another class to handle this. You can create the crosshair and the healtbar for example in the level blueprint. There you can use the event begin play
and if I have 30 levels, I have to do it in every level?
I try to construct one method, wait a moment
This is an easy method, but not the best.
-
create an own game instance class
-
go to project settings->map and modes
-
set the game instance class to the new created
-
Add a custom event to the game instance class (you need to put a delay after open
level, because the level needs some time to load, otherwise the next code would instantly execute so that it wouldnt work.
- call the function when ever you want
In addition you can add the loading screen Widget into the LoadLevel function
Thanks you for help





