Created
September 1, 2012 07:16
-
-
Save eriksk/3566320 to your computer and use it in GitHub Desktop.
Kill script for unity, will destroy an object after a specified amount of time. Really handy for particles and stuff
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
using UnityEngine; | |
using System.Collections; | |
public class KillAfterTime : MonoBehaviour { | |
public float time = 0f; | |
float current = 0f; | |
void Update () { | |
current += Time.deltaTime; | |
if(current > time) | |
{ | |
Destroy(this.gameObject); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment