0
我获得了代码的这个snippit,它实例化了一个粒子系统预制。我遇到的问题是克隆在5秒延迟后不会被破坏。任何建议表示赞赏。Unity C#4.5.2 2D销毁实例化的粒子系统预制
private ParticleSystem instantiate(ParticleSystem prefab, Vector3 position)
{
ParticleSystem newParticleSystem = Instantiate(
prefab,
position,
Quaternion.identity
) as ParticleSystem;
if(newParticleSystem.gameObject != null)
{
Destroy(
newParticleSystem.gameObject,
newParticleSystem.startLifetime
);
}
return newParticleSystem;
}