Using CanvasRenderTarget2D without lag

Hi,

I’m using a CanvasRenderTarget2D to draw dynamic data on 3D objects. Her’s my process :

  • I setup a CanvasRenderTarget2D and feed it to a material
  • I have an object using this material in the world
  • In PlayerController::PlayerTick(), I call UpdateResource() on the texture target
  • The DrawToCanvasRenderTarget() callback is called at some point, I draw here
  • I see the results

The problem is, it looks like there is one frame of lag. It looks like the texture target gets rendered in the material before being updated. The same canvas drawing process, if done post-render in the HUD, arrives one frame early.

Is there a way to fix this ?

Fixed by ticking the relevant actor after update. (TG_PostUpdate or someting).