Download

Need help with frame change callback

I am writing a C++ plugin which runs most of its work in a separate thread. I have several custom Blueprint functions (also in C++) which access data produced by the thread. In order to ensure that the thread work cannot change in the middle of evaluating the different blueprint functions (ie: so that one function call doesn’t get a different value than another on the same frame), I need to put some form of sync call that triggers at the beginning or end of a frame. This trigger will tell the thread code to copy its intermediate data into the structure accessible by the blueprint functions.

I cannot find a simple way for the C++ code to register the need to be called once per frame. I can see how to do it if I create an Actor object and have the developer add the object to the level. The problem there is that I cannot ensure my actor tick event happens first.

The preferable way is to have some function which gets called in C++ on either start/end of frame or start/end of rendering without the need for the game developer to have to do anything other than enable my plugin.

Any pointers? I cannot find a document which clearly lays out the order of operations and callbacks in the main game loop.

thanks,
Rob