19 lines
513 B
C#
19 lines
513 B
C#
using UnityEngine;
|
|
|
|
public class ReplayParticleSystems : MonoBehaviour
|
|
{
|
|
// 调用这个方法来重新播放所有子物体上的粒子系统
|
|
public void ReplayAllParticleSystems()
|
|
{
|
|
foreach (Transform child in transform)
|
|
{
|
|
ParticleSystem particleSystem = child.GetComponent<ParticleSystem>();
|
|
if (particleSystem != null)
|
|
{
|
|
particleSystem.Stop(); // 停止粒子系统
|
|
particleSystem.Play(); // 重新播放粒子系统
|
|
}
|
|
}
|
|
}
|
|
}
|