用途:uloop-screenshot 用于对 Unity 编辑器窗口或 Game View 渲染截图并保存为 PNG,适合视觉检查、调试、文档记录,以及为鼠标模拟工具提供带标注的 UI 元素坐标。
主要能力:支持按窗口名截图(如 Game、Scene、Console、Inspector、Project、Hierarchy、Profiler 及自定义 EditorWindow 标题);窗口名匹配支持 exact、prefix、contains 三种模式且不区分大小写;可设置分辨率缩放(0.1 到 1.0);capture-mode 支持 auto、window、rendering、GameView,其中 rendering 仅限 PlayMode,用于只截取游戏渲染;可标注交互式 UI 元素(--annotate-elements)或 3D 物理碰撞体候选(--annotate-raycast-grid),并可用 --raycast-layer-mask 限定物理层;--elements-only 只返回标注 JSON 不写图片。
使用方式:命令为 uloop screenshot [--window-name <name>] [--resolution-scale <scale>] [--match-mode <mode>] [--capture-mode <mode>] [--annotate-elements] [--annotate-raycast-grid] [--raycast-layer-mask <layers>] [--elements-only] [--output-directory <path>]。输出目录为空时使用默认路径 .uloop/outputs/Screenshots/,也接受绝对路径。必要时先用 uloop focus-window,目标窗口需已在编辑器中打开。
输出与限制:返回 JSON,含 ScreenshotCount、ResolvedCaptureMode、Screenshots(ImagePath、FileSizeBytes、Width、Height、ImageCoordinateSystem、ResolutionScale、ImageToInputOffsetY、GameViewWidth/Height、ScreenshotToInputFormula)、AnnotatedElements 及射线层诊断字段。多窗口匹配时按编号文件名全部捕获。标注与元素坐标仅在实际解析为 rendering 的 PlayMode 下生效;设备旋转后需重新标注,否则坐标失效;窗口截图在 PlayMode 运行或暂停时可能产生警告。使用截图坐标配合鼠标模拟前应阅读 references/annotated-elements.md。