Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class Decay : MonoBehaviour {
- public float time_ms = 1000.0f;
- private float TimeToDie = 0.0f;
- // Use this for initialization
- void Start () {
- TimeToDie = Time.time + time_ms/1000.0f;
- }
- // Update is called once per frame
- void Update () {
- if (TimeToDie != 0.0f && Time.time > TimeToDie)
- {
- Destroy(gameObject);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement