Native Plugin: What has to happen in the RenderEvent?

Hello Community,
am developing a native plugin in C++ that will manipulate Unity textures and meshes.
I’ve noticed in the official example that it performs such actions as well as rendering actions in a special C++ function called through GL.IssuePluginEvent in the C# script.

My question is, does any access to GPU memory have to happen inside that function?

Surely the rendering tasks have to happen there, but I noticed that I can successfully call s_CurrentAPI->BeginModifyTexture from a C++ function that’s called from FixedUpdate().
Is this defined behavior or could that lead to unpredictable crashes and I’m forced to do everything graphics related in the RenderEvent?
Huge thanks in advance :slight_smile:

Yeah, so… I answered my own question in the most annoying way.
After trying to fix rare spontaneous crashes for days, it turns out this was the cause.

BeginModifyTexture and EndModifyTexture (from the official sample code) have definitely to be called inside the RenderEvent.
Otherwise there is an approximately 1 in 5000 chance that the call causes a non-catchable crash >_<
Guess it is safe to assume that this is the case for all GPU-related tasks.