Search Unity

Parameters for particle projectiles

Discussion in 'Scripting' started by iivo_k, Apr 14, 2017.

  1. iivo_k

    iivo_k

    Joined:
    Jan 28, 2013
    Posts:
    314
    Particles with collision work nicely as weapon projectiles, however the OnParticleCollision method only identifies the GameObject that the collision happened with and there's no possibility for additional parameters that I can see.

    Imagine you have a powerup that's active for a limited time and should be applied to each projectile when they're fired. The powerup runs out before the particle collides, so it's no longer active on the weapon, but should still be active for the projectile. In this case it's not enough to identify the weapon that fired it via the GameObject upon collision, you'd need some way to attach data to the particle or at least identify it. Getting a particle ID on emit and the same one on collision would be enough, you could then map data to the particle ID yourself.

    Of course you could just update particles manually or use some other method, but I feel this would be a pretty simple and useful way to do it. Are there ways to accomplish this currenly, or would it be possible go get something like this added?