There’s nothing builtin at the moment iirc. But it shouldn’t be too hard to implement a component/sub-system which handle these things for you.
You basically inherit from
Object type to create your subsystem, which you then create an instance of. Which you then pass to
Context::RegisterSubsystem(...) to have it as a subsystem in your application. Look at
Source\Urho3D\Core\Timer.h/cpp for a simple sub-system used by the engine.
You then listen to
E_ENDFRAME (or both) to process pending events.
Storing events for calling later should be easy. All you need to store is the hash of the event you want to emit, a pointer to the sender (because the event must appear to come from the sender not your sub-system), a
VariantMap with the event parameters and the conditions required to send that event. All of which should be trivial to store in a
Be aware of the sender lifetime tho! I hope I don’t have to warn you about the consequences of accessing freed memory. How you tackle this issue is up to you.
On each frame event your custom sub-system receives, you process the array of pending event conditions. And if the condition is met, you invoke the
SendEvent(...) method on the sender with the hash and stored
This would the simplest approach to this if all you need is a timer.
If however the number of pending events is huge and processing starts to affect your frame-time. You may have to look a different approaches. Like processing conditions in a separate thread. But that’s outside the scope of this post.