Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Ever appropriate in Unity to use particles to affect gameplay?

Discussion in 'Scripting' started by s_guy, Jul 1, 2013.

  1. s_guy

    s_guy

    Joined:
    Feb 27, 2013
    Posts:
    102
    I've worked in some game engines where, under somewhat narrow circumstances, it was more convenient and/or more efficient to use particles instead of game objects for gameplay-affecting entities. For example, if particle collision with a surface was an event you could subscribe to, and you wanted the game effect tightly coupled with visual effect created by an emitter, then it might be appropriate to let the particles affect gameplay.

    Looking at the docs...

    http://docs.unity3d.com/Documentation/ScriptReference/ParticleSystem.html

    http://docs.unity3d.com/Documentation/ScriptReference/ParticleSystem.Particle.html

    ...the particle system really seems set up as a visual-effects-only sort of thing (as one would expect). You can query particle properties, e.g. position, but I doubt that's the sort of thing you'd want to do without an event to determine when the particle has interacted with the game world.

    Has anyone found any circumstance in Unity where it was useful to have a particle system affect gameplay?
     
  2. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,724
    As far as I know unity particles can affect gameplay.
     
  3. s_guy

    s_guy

    Joined:
    Feb 27, 2013
    Posts:
    102
    They surely can. I can query info from them and do any number of things in game with that information. I'm asking "when is this appropriate to do, if ever?"

    Particles don't broadcast events (as far as I can tell), and it's likely prohibitively expensive to query all particles every frame. So, it seems like driving gameplay from particles is "doing it wrong". For example, if you want collision events on emitter particles (it's not good enough for the emitter to just be an abstraction of what's going on in game), it might be better to make some game objects that behave like particles and not try to make particles behave like game objects.

    I'm wondering if anyone has found a context in Unity where they thought it was appropriate to drive gameplay from particles, despite it probably not being the best way to do things most of the time.

    Have you ever had the inclination to do this but solved it another way instead?
     
    Last edited: Jul 1, 2013
  4. Giometric

    Giometric

    Joined:
    Dec 20, 2011
    Posts:
    170
    I don't know if the Shuriken particles support this yet, but the legacy particles have World Particle Collider. These can be set to send a message to the object they collided with; they'll also send the same message to the object they originated from.
     
  5. s_guy

    s_guy

    Joined:
    Feb 27, 2013
    Posts:
    102
    Huh? Cool! Looks like this feature is coming to Shuriken in 4.2 http://answers.unity3d.com/questions/370995/40-shuriken-particle-collision-with-gameobjects.html

    I guess this methodology is not as against the grain as I thought.