Last active
August 29, 2015 14:16
-
-
Save OutlawGameTools/a736d0c5b870c039c839 to your computer and use it in GitHub Desktop.
CS109 - Generic utilities for particles, such as bring particle up to a named layer so it can be seen.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma strict | |
public var layerName : String = "Foreground"; // the layer in which the particle should be placed | |
public var orderInLayer : int = -1; // -1 to go behind the parent object, 1 to go in front of it | |
public var destroyAfterTime : float = 0; | |
private var pSys : ParticleSystem; | |
function Start () { | |
pSys = GetComponent.<ParticleSystem>(); | |
pSys.GetComponent.<Renderer>().sortingLayerName = layerName; | |
pSys.GetComponent.<Renderer>().sortingOrder = orderInLayer; | |
if (destroyAfterTime > 0) | |
Destroy(pSys, pSys.duration + pSys.startLifetime); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment