How to draw a mesh for a single frame with vsync disabled?

I have a mesh for drawing bullet trails as a line. The bullets travel instantly, so I just want to draw it for a single frame. If the line is visible for too long, and the player is moving while firing, the gun will move away from the line and it will be left floating in space, which looks bad. I don’t want to move the line with the gun, I need the line to only be visible while it is in the same location as the gun barrel.

This is what I have:

    int renderCount = 0;

    void OnRenderObject()
    {
        if (renderCount < 1)
        {
            Graphics.DrawMesh(mesh, matrix, material, 0);
        }

        renderCount++;
    }

This works with vsync enabled. With vsync off, the line is only occasionally visible. I assume this is because the scene is being rendered multiple times before being displayed on the screen. Even using if (renderCount < 5) does not show the line consistently.

Am I correct? Is there a solution? Is there a way to know when something has actually been rendered?

I think what you need is the exact moment, a frame was renderer to the screen. This could help render as long as this Unity message is called, then stop

MonoBehaviour.OnPostRender

Just read the documentation here
Graphics.DrawMesh
and it seems that it should definitely draw it for one frame. You might want to file a bug report (under Unity → Help → Report a bug) on the docs.