Screenshots in Diving Minigame
This commit is contained in:
@@ -57,8 +57,11 @@ namespace Utils
|
||||
}
|
||||
}
|
||||
|
||||
// Wait for UI to hide
|
||||
// Wait for UI to hide and render to complete
|
||||
yield return new WaitForEndOfFrame();
|
||||
yield return null; // Wait one more frame for good measure
|
||||
|
||||
Logging.Debug($"[PhotoManager] About to capture. CaptureArea: {captureArea.name}");
|
||||
|
||||
// Capture photo
|
||||
bool captureComplete = false;
|
||||
@@ -68,6 +71,7 @@ namespace Utils
|
||||
{
|
||||
capturedPhoto = texture;
|
||||
captureComplete = true;
|
||||
Logging.Debug($"[PhotoManager] Capture callback received. Texture: {(texture != null ? $"{texture.width}x{texture.height}" : "NULL")}");
|
||||
}, mainCamera, clampToScreenBounds);
|
||||
|
||||
// Wait for capture to complete
|
||||
@@ -129,6 +133,12 @@ namespace Utils
|
||||
|
||||
if (mainCamera == null) mainCamera = Camera.main;
|
||||
|
||||
// Debug: Log RectTransform details
|
||||
Logging.Debug($"[PhotoManager] CaptureArea RectTransform: {captureArea.name}");
|
||||
Logging.Debug($"[PhotoManager] CaptureArea anchoredPosition: {captureArea.anchoredPosition}");
|
||||
Logging.Debug($"[PhotoManager] CaptureArea sizeDelta: {captureArea.sizeDelta}");
|
||||
Logging.Debug($"[PhotoManager] CaptureArea rect: {captureArea.rect}");
|
||||
|
||||
// Use ScreenSpaceUtility to convert RectTransform to screen rect
|
||||
Rect screenRect = ScreenSpaceUtility.RectTransformToScreenRect(
|
||||
captureArea,
|
||||
@@ -138,6 +148,15 @@ namespace Utils
|
||||
);
|
||||
|
||||
Logging.Debug($"[PhotoManager] Capturing area: pos={screenRect.position}, size={screenRect.size}");
|
||||
Logging.Debug($"[PhotoManager] Screen dimensions: {Screen.width}x{Screen.height}");
|
||||
|
||||
// Validate screenRect
|
||||
if (screenRect.width <= 0 || screenRect.height <= 0)
|
||||
{
|
||||
Logging.Error($"[PhotoManager] Invalid screen rect calculated! width={screenRect.width}, height={screenRect.height}");
|
||||
onComplete?.Invoke(null);
|
||||
return;
|
||||
}
|
||||
|
||||
// Use Screenshot Helper's Capture method
|
||||
ScreenshotHelper.Instance.Capture(
|
||||
|
||||
Reference in New Issue
Block a user