background fixes

This commit is contained in:
Savya Bikram Shah
2026-06-01 14:06:28 +05:45
parent 0bf6f64548
commit e821d4e65e
2 changed files with 13 additions and 0 deletions

View File

@@ -48,6 +48,7 @@ namespace Darkmatter.Services.Capture
disabledCanvases = DisableOtherRootCanvases(paperCanvas);
disabledGraphics = HideNonPaperGraphics(paperRT);
HidePaperOwnGraphics(paperRT, disabledGraphics);
cam.clearFlags = CameraClearFlags.SolidColor;
cam.backgroundColor = new Color(0f, 0f, 0f, 0f);
@@ -157,6 +158,18 @@ namespace Darkmatter.Services.Capture
return disabled;
}
private static void HidePaperOwnGraphics(Transform paper, List<UnityEngine.UI.Graphic> disabled)
{
if (paper == null) return;
var graphics = paper.GetComponents<UnityEngine.UI.Graphic>();
foreach (var g in graphics)
{
if (g == null || !g.enabled) continue;
g.enabled = false;
disabled.Add(g);
}
}
private static Rect ComputeCropRect(GameObject target, int screenW, int screenH)
{
if (target == null || target.transform is not RectTransform rt)

Binary file not shown.