Drawing as a Background Task

Godot Version



I use the CanvasItem draw-Calls to draw stuff - which I know is slow. But I don’t need to draw things that often and at the time when I draw them, the corresponding node is not visible on the screen anyway. So this does not need to be fast.

What is the recommended way of doing a task like this “in the background” without slowing down the main loop of the game? Threads (is this safe?)? Is there some other way to do stuff only when the engine is not busy with something else?

test it first with Threads

Instancing nodes that render anything in 2D or 3D (such as Sprite) is not thread-safe by default. To make rendering thread-safe, set the Rendering > Driver > Thread Model project setting to Multi-Threaded .

demo example:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.