Skip to content

Instantly share code, notes, and snippets.

@eriksk
Created September 1, 2012 07:16
Show Gist options
  • Save eriksk/3566320 to your computer and use it in GitHub Desktop.
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
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