fix: the camera under UIParticle will be assigned as _orthoCamera

Prevents unintended camera control
pull/289/head
mob-sakai 2023-08-18 17:23:13 +09:00
parent 9b2e5c1d10
commit c42f8c8ab0
1 changed files with 10 additions and 1 deletions

View File

@ -582,7 +582,16 @@ namespace Coffee.UIExtensions
// When render mode is ScreenSpaceOverlay, use ortho-camera. // When render mode is ScreenSpaceOverlay, use ortho-camera.
if (!_orthoCamera) if (!_orthoCamera)
{ {
_orthoCamera = GetComponentInChildren<Camera>(); // Find existing ortho-camera.
foreach (Transform child in transform)
{
var cam = child.GetComponent<Camera>();
if (cam && cam.name == "[generated] UIParticleOverlayCamera")
{
_orthoCamera = cam;
break;
}
}
// Create ortho-camera. // Create ortho-camera.
if (!_orthoCamera) if (!_orthoCamera)