@@ -23,6 +23,9 @@ public class GameRecorder : MonoBehaviour
2323 [ Tooltip ( "The maximum width of the video. The video will be downscaled if the screen resolution is higher." ) ]
2424 public int MaxVideoWidth = 1920 ;
2525
26+ [ Tooltip ( "If enabled, renders the FPS overlay on the video." ) ]
27+ public bool RenderFPSOverlay = true ;
28+
2629 [ Tooltip ( "If enabled, renders the mouse cursor position in the recorded video." ) ]
2730 public bool RenderCursor = false ;
2831
@@ -314,14 +317,27 @@ private byte[] ApplyFPSOverlay(byte[] frameData, int width, int height)
314317 // Create a byte buffer wrapper to work with the frame data directly
315318 var bufferWrapper = new ByteBufferWrapper ( _rgbaDataBuffer , width , height , 4 ) ; // RGBA format
316319
317- // Draw FPS overlay directly on the buffer
318320 // flipY=true means Y=0 is at the bottom, so coordinates work like mathematical coordinates
319- var painter = new TexturePainter ( bufferWrapper , flipY : true ) ;
320- painter . DrawNumber ( 5 , 5 , ( int ) _fps , Color . white , 2 ) ; // This will draw near bottom-left corner
321+ TexturePainter painter = null ;
322+
323+ // Draw FPS overlay directly on the buffer
324+ if ( RenderFPSOverlay )
325+ {
326+ if ( painter == null )
327+ {
328+ painter = new TexturePainter ( bufferWrapper , flipY : true ) ;
329+ }
330+ painter . DrawNumber ( 5 , 5 , ( int ) _fps , Color . white , 2 ) ; // This will draw near bottom-left corner
331+ }
321332
322333 // Draw cursor if enabled
323334 if ( RenderCursor )
324335 {
336+ if ( painter == null )
337+ {
338+ painter = new TexturePainter ( bufferWrapper , flipY : true ) ;
339+ }
340+
325341 // Get mouse position in screen coordinates
326342 Vector3 mousePos = Input . mousePosition ;
327343
0 commit comments