Spaces:
Runtime error
Runtime error
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class SelfDestroy : MonoBehaviour | |
{ | |
public float TTL = 2; | |
void Update() | |
{ | |
if (TTL < 0) Destroy(gameObject); | |
TTL -= Time.deltaTime; | |
} | |
} |