fix: the camera under UIParticle will be assigned as _orthoCamera
Prevents unintended camera controlpull/289/head
parent
9b2e5c1d10
commit
c42f8c8ab0
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue