// WL793_Shot.cs — #793~#795 해상도별 실측 + 에디트 모드 렌더 캡처 (읽기 전용: 디스크 에셋 미수정) // // 1) unity command run_script --file AgentScripts/WL_GameViewSize.cs --entry WL_GameViewSize.Set --args '[1080,1920]' // 2) unity command run_script --file AgentScripts/WL793_Shot.cs --entry WL793_Shot.Shot --args '["1080x1920",0]' // mode 0 = TitleInfo.prefab (실제 타이틀 화면) // mode 1 = Title.unity 팝업 (btn_ok 검증) // mode 2 = TitleInfo + 마젠타 클리어 (검정 백드롭이 실제로 덮는지 진단) // // 왜 임시 카메라인가: 이 씬의 캔버스는 ScreenSpaceOverlay 이고 씬에 카메라가 아예 없다. // Overlay 는 런타임 백버퍼에만 합성되므로 capture_game_view 는 에디트 모드에서 캡처가 불가능하다 // (source=screen -> "requires Play Mode", source=camera -> "No camera found"). // => 임시 카메라 + RenderTexture 로 직접 렌더한다. // // 안전장치: 이 스크립트는 씬을 절대 저장하지 않는다. 메모리에서만 조작하고 마지막에 // OpenScene 으로 디스크 상태를 다시 불러와 변경을 버린다. Title.unity 해시는 전후 동일해야 한다. using System.Collections.Generic; using System.Text; using UnityEditor; using UnityEditor.SceneManagement; using UnityEngine; using UnityEngine.UI; public static class WL793_Shot { const string ScenePath = "Assets/Scenes/Title.unity"; const string PrefabPath = "Assets/ResWork/UIPrefabs/Title/TitleInfo.prefab"; const string OutDir = "Screenshots_WL/title"; /// Overlay 캔버스에서 RectTransform 의 월드 코너 = 화면 픽셀. 그 상태로 재야 정확하다. static Vector2 ScreenSize(RectTransform rt) { var c = new Vector3[4]; rt.GetWorldCorners(c); return new Vector2(Vector3.Distance(c[0], c[3]), Vector3.Distance(c[0], c[1])); } static Vector2 ScreenCenter(RectTransform rt) { var c = new Vector3[4]; rt.GetWorldCorners(c); return (c[0] + c[2]) * 0.5f; } static void Measure(Transform root, string tag, StringBuilder sb) { foreach (var b in root.GetComponentsInChildren