The timer is set to trigger the event after 1 sec, but it doesn’t work. I see in debug that the SetTimerByEvent node is executed, but event does not. The only place where the timer is cleared is on “Back” button pressed, so it doesn’t seem to be a reason…
You’re starting a new timer, every time the player moves the slider.
Also, what’s in ‘get my game instance’? Is that node working? Are you getting ‘none’ errors when play stops?
I don’t get any errors when play stops, even if I move a slider and close game right away. You think the timer can fire after the game instance is destroyed? Maybe I don’t get error only because my timer doesn’t fire at all.
I don’t know how to check if I launch a new timer each time SetTimer node is hit, since I don’t know how to to convert timer handle into string… Do you know how to do that?
And even if it is a new timer each time, this node must create multiple timers, and each of them should fire, but in fact no timer fires, execution sequence of that event is never executed, it is seen in debug…
Why are you using a timer anyway? Why not just save the new setting each time?
It makes the game lag, if I do it so often. Saving something to a hard drive isn’t supposed to be fast…
Ok, if you want to delay it, just put the write part when they leave the widget.
Look, I’m learning Unreal. I need to expand my knowledge. Looks like I don’t understand something about timers. I need to know why doesn’t it work as it should.
I think ‘on value changed’ is only called when you let go of the widget, no?
In any event, a timer is not the way to do this, I think that’s why you’re having a problem. If anything, it would be better to set a bool, saying, ‘an update has taken place’. And then, when they close the widget, you can check the bool and make the update if need be.
The way you have it now, every time they change the value, a new timer is started and the variable ‘slider timer handle’ is overwritten.
“I think ‘on value changed’ is only called when you let go of the widget, no?”
It is UMG slider widget. OnValueChanged is called whenever you move a slider, no matter if you let go of it or not.
I cannot check if multiple timers are created. Those handles don’t even have a == operator… How do I check it? Is there some documentation?
Logically, it should work even if this node creates multiple timers. The question is, why the event isn’t triggered even once…
And if it creates multiple timers, how to implement logic of using only one timer? There is no node in blueprints that starts a timer with a specific timer handle…
Very easy to check - print node
Like I say, this is not a place to use a timer.
If it did work, how long do you set the timer for? You don’t know how long they are going to play around with the slider for.
What is “print node”? I fail to google it. The only thing I manage to find is Print String, though as I said, there is no conversion from timer handle to string, so I can’t use it…
Yes, print string. You don’t need to convert, you just need to know how many timers you’re starting. Put this
here
Like I said, it’s a matter of understanding the engine, which is important for a newbie like me.
The timer is set for 1 sec. If the user moves the slider around, it does nothing, so the user suffers no lags. If it doesn’t move for at least 1 sec, the settings are stored to the hard drive, so these stores are rare enough to not cause lags, and at the same time reliably inevitable.
The user can drag the slider around, and then leave the widget before the timer calls the save function.
You mean, to count how many times SetTimerByEvent node is called? But how will I know if it is called with the same timer handle or not?
It will not be the same handle, because the whole point of handles is they are all different.
Many timers can be set on one event
You’re setting up a separate timer for each movement of the slider.
“It will not be the same handle, because the whole point of handles is they are all different.”
Well, it sounds like important information, where can I read about it? Because it is not self-evident, I mean, if it creates a new handle each time, why there is no node to start a timer with a SPECIFIC handle? You can do it in c++ (actually you always specify a handle there).