fix: SetParticleSystemInstance/Prefab APIs destroy generated objects

# Conflicts:
#	Packages/src/Runtime/UIParticle.cs
pull/318/head
mob-sakai 2024-06-26 17:17:38 +09:00
parent 835817049f
commit ae3f3a8e62
1 changed files with 6 additions and 2 deletions

View File

@ -404,9 +404,13 @@ namespace Coffee.UIExtensions
{
if (!instance) return;
foreach (Transform child in transform)
var childCount = transform.childCount;
for (var i = 0; i < childCount; i++)
{
var go = child.gameObject;
var go = transform.GetChild(i).gameObject;
if (go.TryGetComponent<Camera>(out var cam) && cam == _bakeCamera) continue;
if (go.TryGetComponent<UIParticleRenderer>(out var _)) continue;
go.SetActive(false);
if (destroyOldParticles)
{