From c42f8c8ab0ff033689349a81e02a4808e071a8a2 Mon Sep 17 00:00:00 2001 From: mob-sakai Date: Fri, 18 Aug 2023 17:23:13 +0900 Subject: [PATCH] fix: the camera under UIParticle will be assigned as _orthoCamera Prevents unintended camera control --- Scripts/UIParticle.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Scripts/UIParticle.cs b/Scripts/UIParticle.cs index 3625105..0e7de0f 100644 --- a/Scripts/UIParticle.cs +++ b/Scripts/UIParticle.cs @@ -582,7 +582,16 @@ private Camera GetBakeCamera() // When render mode is ScreenSpaceOverlay, use ortho-camera. if (!_orthoCamera) { - _orthoCamera = GetComponentInChildren(); + // Find existing ortho-camera. + foreach (Transform child in transform) + { + var cam = child.GetComponent(); + if (cam && cam.name == "[generated] UIParticleOverlayCamera") + { + _orthoCamera = cam; + break; + } + } // Create ortho-camera. if (!_orthoCamera)