// WL_PostProbe.cs — 지면 색/블룸 진단 (Play 전용 · 메모리만) // unity command run_script --file AgentScripts/WL_PostProbe.cs --entry WL_PostProbe.Ray --args '[115.0, 10.0]' // unity command run_script --file AgentScripts/WL_PostProbe.cs --entry WL_PostProbe.SetBloom --args '[0.9, 0.3]' // unity command run_script --file AgentScripts/WL_PostProbe.cs --entry WL_PostProbe.Bloom using System.Linq; using System.Text; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; public static class WL_PostProbe { public static object Ray(float x, float z) { if (!Application.isPlaying) return "not playing"; var sb = new StringBuilder(); var hits = Physics.RaycastAll(new Vector3(x, 60f, z), Vector3.down, 200f).OrderBy(h => h.distance).ToArray(); sb.AppendLine("hits=" + hits.Length); foreach (var h in hits.Take(4)) { var r = h.collider.GetComponent() ?? h.collider.GetComponentInParent(); string mat = r != null && r.sharedMaterial != null ? r.sharedMaterial.name + " / " + r.sharedMaterial.shader.name : "-"; string col = r != null && r.sharedMaterial != null && r.sharedMaterial.HasProperty("_BaseColor") ? r.sharedMaterial.GetColor("_BaseColor").ToString("F2") : "-"; string tex = r != null && r.sharedMaterial != null && r.sharedMaterial.HasProperty("_BaseMap") && r.sharedMaterial.GetTexture("_BaseMap") != null ? r.sharedMaterial.GetTexture("_BaseMap").name : "none"; sb.AppendLine(" - " + h.collider.name + " y=" + h.point.y.ToString("F2") + " renderer=" + (r != null ? r.name : "-") + " mat=" + mat + " base=" + col + " tex=" + tex + " scene=" + h.collider.gameObject.scene.name); } return sb.ToString(); } public static object Bloom() { var sb = new StringBuilder(); foreach (var v in Object.FindObjectsByType(FindObjectsInactive.Include, FindObjectsSortMode.None)) { var p = v.sharedProfile; if (p == null) continue; Bloom b; Tonemapping t; ColorAdjustments c; sb.Append(v.name + " enabled=" + v.enabled + " active=" + v.gameObject.activeInHierarchy + " profile=" + p.name + " weight=" + v.weight + " global=" + v.isGlobal); if (p.TryGet(out b)) sb.Append(" | bloom thr=" + b.threshold.value + " int=" + b.intensity.value + " scatter=" + b.scatter.value + " on=" + b.active); if (p.TryGet(out t)) sb.Append(" | tonemap=" + t.mode.value); if (p.TryGet(out c)) sb.Append(" | exposure=" + c.postExposure.value + " contrast=" + c.contrast.value + " sat=" + c.saturation.value); sb.AppendLine(); } var cam = Camera.main; var add = cam != null ? cam.GetComponent() : null; sb.AppendLine("camera post=" + (add != null ? add.renderPostProcessing.ToString() : "?") + " hdr=" + (cam != null ? cam.allowHDR.ToString() : "?")); return sb.ToString(); } public static object SetBloom(float threshold, float intensity) { if (!Application.isPlaying) return "not playing"; int n = 0; foreach (var v in Object.FindObjectsByType(FindObjectsInactive.Include, FindObjectsSortMode.None)) { var p = v.sharedProfile; if (p == null) continue; Bloom b; if (!p.TryGet(out b)) continue; b.threshold.value = threshold; b.intensity.value = intensity; n++; } return "bloom set on " + n + " profile(s): threshold=" + threshold + " intensity=" + intensity + " (memory only)"; } }