How do I show the crosshair or health bar on the screen after loading the widget? Please help.
I tried to do that and when my loading widget was loaded, nothing appeared during the game
You can use the node “add to viewport”
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.
Ah ok, you want to show another widget after this widget, right?
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.
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
I try to construct one method, wait a moment
You see? Did not work
Yes, to show a different widget that will be displayed during the game
what should I do?
and if I have 30 levels, I have to do it in every level?
Thanks you for help
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