Neodroid  0.2.0
Machine Learning Environment Prototyping Tool
SelfDestruct.cs
Go to the documentation of this file.
1 using UnityEngine;
2 
3 namespace droid.Runtime.Utilities.Sampling {
4  public class SelfDestruct : MonoBehaviour {
5  float _spawn_time;
6  public float LifeTime { get; set; } = 10f;
7 
8  void Awake() { this._spawn_time = Time.time; }
9 
10  void Update() {
11  if (this._spawn_time + this.LifeTime < Time.time) {
12  Destroy(this.gameObject);
13  }
14  }
15  }
16 }