Jump to content

Releasing Particle Emitters


Haydenmango
 Share

Recommended Posts

Do I need to Release() particle emitters once I am done with them or do they Release() themselves once they finish playing?

It seems like I am supposed to Release() them manually and that is what I have been doing but when I look at the FPSgun.lua I can't see where the emitters being created (smoke emitter and blood emitter) are destroyed.

Is this an issue with the FPSgun.lua, do particle emitters Release() themselves, or am I just missing something?

Link to comment
Share on other sites

If you don't plan on using them anymore, then you should release it. Otherwise, it's still a valid entity.

 

I tested this by created an emitter and allowing it to switch between loop and non-loop mode. After it stopped emitting, I could restart it, so it's still in memory. That being said, I doubt you will encounter noticable performance issues, it's more of a good practice thing.

Link to comment
Share on other sites

One-shot emitters will automatically release themselves.

Good to know! I normally put a script on all my particle emitters that will release the particle emitter after a certain time so not having to put scripts on one shot particle emitters is cool.

Link to comment
Share on other sites

Normally, an emitter plays continuously (think of the firepit in the Workshop). This means that the particles flow out indefinitely.

 

A one-shot emitter is when a set number of particles flow out and they don't get recreated or replaced. This would be for something like a collision against a dirt road where the dust doesn't keep coming up from the ground until it is hit again.

 

You can control this with SetLoopMode():

http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/emitter/emittersetloopmode-r93

 

The one thing I don't understand is that I can change this mode after the one-shot collision finishes. Is this because the Lua garbage collector hasn't cleared that spot in memory yet?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...