duck

particle system size multiplier

Dec 19th, 2013
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.52 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class ParticleSystemMultiplier : MonoBehaviour {
  5.  
  6.     // a simple script to scale the size, speed and lifetime of a particle system
  7.  
  8.     public float multiplier = 1;
  9.  
  10.     void Start()
  11.     {
  12.         var systems = GetComponentsInChildren<ParticleSystem>();
  13.         foreach (ParticleSystem system in systems) {
  14.             system.startSize *= multiplier;
  15.             system.startSpeed *= multiplier;
  16.             system.startLifetime *= Mathf.Lerp (multiplier,1,0.5f);
  17.             system.Clear();
  18.             system.Play();
  19.         }
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment