2016-01-18 112 views
1

我遵循Unity3D的Survive Shooter教程,在Unity 5.3中遇到了Unite Day演示文稿和實際行爲之間的若干不一致問題,例如動畫過渡和其他小問題,達到預期的遊戲效果並遵循教程。Unity3D - 重放非循環粒子系統

我無法解決的一個問題是重放非循環粒子系統。在遊戲中,每當敵人被擊中時都會發射擊中的粒子,但是在運行遊戲時,這些粒子會被髮射一次,而不是隨後的命中。

這是粒子系統配置:

enter image description here

原始代碼簡單地重新位置並重新播放該發射:

// 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(); 

怎麼辦我重播粒子發射?

謝謝!

+2

嘗試'ParticleSystem.Emit(...)' –

+0

@JerrySwitalski它仍然只在第一次運行時發射。 – BarakChamo

+1

Scratch,我仍然在'''Emit()''''後面調用'''Play()'''。只要調用'''Emit()'''每次都會發出。 – BarakChamo

回答

2

要回復的ParticleSystem嘗試使用ParticleSystem.Emit(...)與參數適合您的動畫,如:

hitParticles.Emit(5); 
0

如果您需要重置立即粒子系統和重複它(例如步槍BAREL爆炸)我會建議你:

ShootParticles.Simulate(0.0f, true, true); 
ShootParticles.Play();