This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a Unity plugin for BetaHub bug reporting that enables in-game bug submissions with video recording, screenshot capture, and log collection. The plugin is distributed as a Unity Package Manager (UPM) package.
- GameRecorder (
Runtime/Scripts/GameRecorder.cs): Handles video recording using FFmpeg with optimized GPU-based capture - BugReportUI (
Runtime/Scripts/BugReportUI.cs): Main UI component for bug report submission form - Issue (
Runtime/Scripts/Issue.cs): Data model representing bug reports and their upload state - VideoEncoder (
Runtime/Scripts/VideoEncoder.cs): FFmpeg wrapper for video encoding with segmented recording - Process Wrappers: Platform-specific process handling for FFmpeg
- IProcessWrapper (
Runtime/Scripts/IProcessWrapper.cs): Interface for process abstraction - DotNetProcessWrapper (
Runtime/Scripts/DotNetProcessWrapper.cs): .NET/Mono implementation - NativeProcessWrapper (
Runtime/Scripts/NativeProcessWrapper.cs): IL2CPP implementation using native library
- IProcessWrapper (
- Runtime:
io.betahub.bugreporter.asmdef- Main plugin runtime assembly - Editor:
io.betahub.bugreporter.editor.asmdef- Editor-only features (FFmpeg downloader)
The plugin supports Windows, macOS, and Linux with special handling for IL2CPP builds:
- Mono/.NET: Uses standard .NET Process class
- IL2CPP: Requires
ENABLE_BETAHUB_FFMPEGscripting symbol and native process wrapper libraries inPlugins/directories
Platform-specific native libraries for IL2CPP FFmpeg support:
- Windows:
Plugins/x86_64/betahub_process_wrapper.dll - macOS:
Plugins/macOS/libbetahub_process_wrapper.dylib - Linux:
Plugins/Linux/x86_64/libbetahub_process_wrapper.so
This project follows Unity Package Manager conventions:
package.json: Package metadata and dependenciesRuntime/: Runtime scripts and assetsEditor/: Editor-only scriptsSamples~/: Sample scenes and scripts- Assembly definition files (
.asmdef) organize code into separate assemblies
The plugin includes a working demo scene in Samples~/ExampleScene/ with:
- Sample scene setup
- Example integration with
RotateCube.csscript - Pre-configured demo project settings for immediate testing
The plugin automatically downloads FFmpeg binaries through the editor script FfmpegDownloader.cs. Video recording is implemented with:
- Segmented recording (10-second segments, 60-second rolling window)
- GPU-optimized capture using RenderTextures
- Cross-platform process wrapper abstraction
- Error handling and retry logic for file operations
When building with IL2CPP scripting backend:
- Define
ENABLE_BETAHUB_FFMPEGin Player Settings > Scripting Define Symbols - Ensure native process wrapper libraries are included in build
The plugin comes pre-configured with demo project credentials (DEMO_PROJECT_ID = "pr-5287510306") for immediate testing. Reports submitted to the demo project are only visible to the submitter via email links.
There is a test Unity project at /Users/piotrkorzuszek/Projects/betahub/betahub-unity-plugin-workspace-2022/BetaHub Unity Plugin that consumes this plugin. It has a BuildScript.cs in its Assets/ folder (not in this repo — it lives in the workspace project) that can run WebGL builds from the command line. Use this as the primary feedback loop to verify code compiles:
/Applications/Unity/Hub/Editor/2022.3.62f3/Unity.app/Contents/MacOS/Unity \
-batchmode -nographics -quit \
-projectPath "/Users/piotrkorzuszek/Projects/betahub/betahub-unity-plugin-workspace-2022/BetaHub Unity Plugin" \
-buildTarget WebGL \
-executeMethod BuildScript.BuildWebGL \
-logFile /tmp/unity_webgl_build.log 2>&1; echo "EXIT CODE: $?"To check for compile errors: grep -i "error CS" /tmp/unity_webgl_build.log | sort -u
For non-WebGL compilation check (no full build, just opens the project and compiles scripts):
/Applications/Unity/Hub/Editor/2022.3.62f3/Unity.app/Contents/MacOS/Unity \
-batchmode -nographics -quit \
-projectPath "/Users/piotrkorzuszek/Projects/betahub/betahub-unity-plugin-workspace-2022/BetaHub Unity Plugin" \
-buildTarget Android \
-logFile /tmp/unity_android_compile.log 2>&1; echo "EXIT CODE: $?"- Do not generate meta files, let Unity do this
- Use
ruby validate_prefab.rb <prefab_path>to validate Unity prefabs for duplicate IDs and broken references