Unity3D - 重播非循环粒子系统
Unity3D - Replay a non-looping Particle System
我正在学习 Survive Shooter Unity3D 教程,并且在 Unite Day 演示和 Unity 5.3 中的实际行为之间遇到了一些不一致的地方,例如动画过渡和其他我必须弄清楚才能实现的小问题想要的游戏结果并按照教程进行操作。
我无法解决的一个问题是重播非循环粒子系统。在游戏中,每当敌人被击中时都会发射命中粒子,但在 运行 游戏中,这些粒子会发射一次,而不是在后续命中时发射。
这是粒子系统配置:
原代码只是重新定位并重新播放发射:
// Set the position of the particle system to where the hit was sustained.
hitParticles.transform.position = hitPoint;
// And play the particles.
hitParticles.Play();
我试过重置和清除系统,但没有用:
hitParticles.Clear();
hitParticles.time = 0;
hitParticles.Play();
如何重播粒子发射?
谢谢!
要回复 ParticleSystem
,请尝试使用 ParticleSystem.Emit(...)
和适合您的动画的参数,例如:
hitParticles.Emit(5);
如果您使用的是 Unity 5.3.1,那么这听起来很像一个错误(http://issuetracker.unity3d.com/issues/particle-system-plays-only-once)。
如果你需要立即重置粒子系统并重复它(例如步枪枪管爆炸)我会推荐你这个:
ShootParticles.Simulate( 0.0f, true, true );
ShootParticles.Play();
我正在学习 Survive Shooter Unity3D 教程,并且在 Unite Day 演示和 Unity 5.3 中的实际行为之间遇到了一些不一致的地方,例如动画过渡和其他我必须弄清楚才能实现的小问题想要的游戏结果并按照教程进行操作。
我无法解决的一个问题是重播非循环粒子系统。在游戏中,每当敌人被击中时都会发射命中粒子,但在 运行 游戏中,这些粒子会发射一次,而不是在后续命中时发射。
这是粒子系统配置:
原代码只是重新定位并重新播放发射:
// Set the position of the particle system to where the hit was sustained.
hitParticles.transform.position = hitPoint;
// And play the particles.
hitParticles.Play();
我试过重置和清除系统,但没有用:
hitParticles.Clear();
hitParticles.time = 0;
hitParticles.Play();
如何重播粒子发射?
谢谢!
要回复 ParticleSystem
,请尝试使用 ParticleSystem.Emit(...)
和适合您的动画的参数,例如:
hitParticles.Emit(5);
如果您使用的是 Unity 5.3.1,那么这听起来很像一个错误(http://issuetracker.unity3d.com/issues/particle-system-plays-only-once)。
如果你需要立即重置粒子系统并重复它(例如步枪枪管爆炸)我会推荐你这个:
ShootParticles.Simulate( 0.0f, true, true );
ShootParticles.Play();