Advertisement
Guest User

Untitled

a guest
Apr 25th, 2015
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #pragma strict
  2.  
  3. public var layerName : String = "Foreground"; // the layer in which the particle should be placed
  4. public var orderInLayer : int = -1; // -1 to go behind the parent object, 1 to go in front of it
  5.  
  6. public var destroyAfterTime : float = 0;
  7.  
  8. private var pSys : ParticleSystem;
  9.  
  10. function Start () {
  11.  
  12. pSys = GetComponent.<ParticleSystem>();
  13. pSys.GetComponent.<Renderer>().sortingLayerName = layerName;
  14. pSys.GetComponent.<Renderer>().sortingOrder = orderInLayer;
  15.  
  16. if (destroyAfterTime > 0)
  17. Destroy(pSys, pSys.duration + pSys.startLifetime);
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement