I’m writing a plugin that defines an actor with a component that gets a copy of the screen from the viewport every 10 seconds using the ReadPixels
method.
While running it in the editor it works just fine but when running from a standalone package or exe it crashes with the message “Rendering thread exception”
According to the code, when ReadPixels
is called the engine throws a command to read the pixels onto the the que for the rendering thread then waits for the rendering thread to clear.
In the editor it finishes in just a couple wait cycles and is fine. When running the game by itself it takes dozens of cycles then it says that the rendering thread crashed without giving any more detail than that.
I was using 4.0.1 and saw in some of the changenotes that they mentioned a fix to screenshot capturing, so I updated to 4.2.1 but still got the same issue.
Is ReadPixels
not supposed to be called during a tick operation? If so, why does it work in the editor and is there an alternative I can use? If not, where can I safely call it from?