Unity3D-重播非循环粒子系统 [英] Unity3D - Replay a non-looping Particle System

查看:204
本文介绍了Unity3D-重播非循环粒子系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在关注生存射手 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);

I'm following the Survive Shooter Unity3D tutorial and have come across several inconsistencies between the Unite Day presentation and actual behavior in Unity 5.3, such as animation transition and other small issues I had to figure out to achieve the desired gameplay result and follow the tutorial.

One issue I'm unable to resolve is replaying a non-looping particle system. In the game hit particles are emitted whenever an enemy is shot, but when running the game these particles are emitted once and not upon following hits.

This is the particle system configuration:

The original code simply re-positions and re-plays the emission:

// Set the position of the particle system to where the hit was sustained.
hitParticles.transform.position = hitPoint;

// And play the particles.
hitParticles.Play();

I've tried resetting and clearing the system but that didn't work:

hitParticles.Clear();
hitParticles.time = 0;
hitParticles.Play();

How do I replay the particle emission?

thanks!

解决方案

To reply the ParticleSystem try to use ParticleSystem.Emit(...) with parameters that suits your animation like:

hitParticles.Emit(5);

这篇关于Unity3D-重播非循环粒子系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆