Search Unity

Modifying Particle System modules at runtime performance

Discussion in 'General Graphics' started by The_BenEvans, Feb 5, 2019.

  1. The_BenEvans

    The_BenEvans

    Joined:
    Jul 31, 2012
    Posts:
    139
    Hey there,

    I'm basically making a turret that fires "bullets" at a moving target. Damage is handled by code, so all the particles have to do is look pretty and appear to hit the target.

    I'm currently experimenting with caching the Main module of the bullet particle system, and then changing the particles lifetime to have the particle die as it reaches the targets position (lifetime = distance / particle speed).

    This is going on in multiple Particle Systems, potentially once per frame. Is this going to be doing horrible things to Particle System performance under the hood?

    Thanks
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,282
    That is fine. There's not really much benefit to caching the Main module, caching the ParticleSystem is enough although it won't hurt.
     
  3. The_BenEvans

    The_BenEvans

    Joined:
    Jul 31, 2012
    Posts:
    139
    @karl_jones Thanks for the quick reply! Looks much better now
     
    richardkettlewell and karl_jones like this.