I have a problem…
with these i spawn a timer at the right top of the screen
Now i have to spawn him in the level’s blueprint and when i put the timer in the level it doesn’t spawn
Why?How i resolve?
can someone help me?
I believe you are using timers incorrectly, take a look at that to make sure you are using them correctly.
Please what? What is the “Timer” you are talking about? Show us the Nodes you put into the Timer Function.
And what should this exactly do? You are calling it on the BeginPlay of the LevelBlueprint (still no idea what “Timer” does).
And you are calling it each “tick” of the HUD Blueprint. The BeginPlay call is redundant, because you are already calling it on
tick inside of the HUD Blueprint + the HUD Actor might not be spawned when you try to call it in BeginPlay.
You need to make sure that the HUD Actor is correctly spawned before you try to call functions on him.
Better use the BeginPlay of the HUD Actor itself.
EDIT: Since i already answered 2 of your posts: PLEASE work on your way posting things. Add more details! Explain
what you tried and what is wrong. Don’t just say “look here, not working”. Otherwise someone will ask for more details
and you have to explain it anyway!
sorry…this is the fuction timer
I don’t understand… the begin play it’s a node that works forever? not only 1 time?
The BeginPlay is only called once when the Level is started. At this point, your HUD Actor doesn’t have to be spawned already.
So you might call the function of the HUD Actor without it even being spawned. (Have you checked if cast in your LevelBP BeginPlay
is not failing?).
The “ReceiveDrawHUD” in your HUD BP on the other hand is a tick function. It is called as soon as the Actor is spawned and begins
to tick. So the timer function will be called from this moment on.
If i understood you correctly, the Timer works without the LevelBP. So the ReceiveDrawHUD call is working.
That shows me, that the LevelBP BeginPlay call is indeed too early AND is only one tick long.
I don’t really get why you want that timer in the BeginPlay of the Level. You can’t show the timer before the HUD class,
that is responsible for drawing the timer, is spawned. And when it is spawned, you will get the timer with the ReceiveDrawHUD.
So it’s not necessary to call something in the LevelBP.
I taked the timer here because if i set it in the hud class it spawn in the menù too… and i don’t want it
Then you need to work with states. Make a bool, something like “bIsMenuOpen”, and set it to true if your menu is open.
Add the Bool and a Branch in your HUD directly in front of the Timer Function call and connect it with the “false” exec of the branch.
So that the timer is only drawn when the Menu is closed.
the menù is a level i have to talk with that level variables for do this, or i wrong?
Wait, your whole level is the Menu? I don’t really get your setup sorry. You have a Timer that you want to display but not when
the Menu is open or? I told you how to fix that. What exactly do you mean with “The menu is a level”? If the Menu is a level
and you don’t want to have the timer in it, then just don’t call it each Level has its own GameMode and HUD Class.
So if in in the hud class of first level set the timer…in the menù it doesn’t exist?
Like i said, each level has a GameMode. Each GameMode can have a HUD Class. If you have 2 Levels, one for your MainMenu and one for your actual Gameplay, then
you can add the HUD Class containing the Timer only to the GameMode of the Gameplay level. You just need to create 2 different GameModes and fill the HUD Class
in its settings. You should already have done this for you current GameMode, since you have the HUD Class running. Just create a second one that does not have
this HUD Class set.
When you have a level open, you can click on “Blueprints” at the top bar of the editor. There you can set a standard GameMode. You should do this with your
MainMenu GameMode. Then you open the Gameplay level and instead of setting the standard GameMode again, you simply override it (there is an option to do that) and
selecte the second GameMode for this override.
- Create 2 GameModes, one with the HUD Class that has the Timer and one without (or with the standard HUD)
- Open your MainMenu Level and click on Blueprints (like in the picture above) and for “ProjectSettings”, select the GameMode of your MainMenu. Remember to save the Map at this point!
- Now open your GamePlay Level and click on Blueprints again. You should see that the ProjectSettings GameMode is still set to the MainMenu one. Instead of setting it to the Gameplay
Level one, which should contain the Timer HUD Class, you fill this GameMode to the “WorldOverride” setting. This will simply override your standard chosen MainMenu GameMode with the
Gameplay Level GameMode for this specific level.
thanks a lot man