The one-shot particle emitters aren’t working as I’d expect them to, and I’m hoping someone has a suggestion for me. I’ve searched the forums, and found a similar conversation, but w/o a non-hack solution.
Anyway, for simple, one-shot explosion effects, I figured that putting the emitter as one-shot and the particle animator as auto destruct would just get rid of the emitter as soon as the first batch of particles went away. Not so. From the forums, it would appear as though as long as the emit property is true, the one-shot effect will just loop over and over, and it does.
That means for a simple, one-time explosion effect, I needed to attach a script to it that was something like this:
var hack : boolean = false;
function OnUpdate() {
if (hack) particleEmitter.emit = false;
else hack = true;
}
This, of course, feels extremely hacky, and like a waste. It works, but is there a way to do simple, one-time effects like this without a script?
Thanks for any suggestions! Love Unity!
Jeff M.
Given what’s been discussed elsewhere it seems you already know the answer (no). I’m personally not clear whether we have a doc bug or a functional bug here in that setting a particle system to one shot fails to do a single shot emission and then stop. The documentation wording is just confusing enough to me to make me wonder so I’ve logged a bug about this to see if we can either clarify/update the docs or fix the bug. As to auto-destruct, the docs do clearly state that this property works in conjunction with the emit property (if auto-destruct is true and you set emit to false, the particle emitter is destroyed).
So as you’ve read elsewhere the reality is that you’ll need to have a script in place that sets the emit property to false.
Edit: and after a brief conversation with others this has now been logged as a functional bug in particle emitters. Until it’s fixed you’ll need to use the described techniques to work around the issue.
i’ve requested this too
http://forum.unity3d.com/viewtopic.php?t=5227
this would be great if it were changed, as in most circumstances fire one shot is what you would want ; )
But if you change this please don’t take away the ability to do a looping one shot (unless you really want to). I have used it on occasion.
I second that…one-shot is a reference to the way the particles are emitted (all at once rather than in a stream), and I definitely understand the confusion because I suffered from it myself at first :), but whether to loop or not should be a separate thing, I think. Not just tied to one-shot. Although it would definitely be useful to do one-time effects without having to use scripts.
–Eric
I will add your comments to the bug report. I initially logged it as a documentation bug (meaning the current behavior is correct and needs to be explained better in the docs), but after an IM with Joachim we changed it to a functional bug. We’ll give this all some careful thought and do our best in resolving it, thanks for chiming in guys.