Tanoda
DelayedDestroy.cs
Go to the documentation of this file.
1using System.Collections;
2using System.Collections.Generic;
3using UnityEngine;
4
5public class DelayedDestroy : MonoBehaviour
6{
7 public bool DeactOnly = false;
8 public float delay;
9 public static GameObject EpilepsyFixer;
10
11 IEnumerator Start()
12 {
13 EpilepsyFixer = gameObject;
14 yield return new WaitForSeconds(delay);
15 if (DeactOnly)
16 {
17 gameObject.SetActive(false);
18 yield break;
19 }
20 Destroy(gameObject);
21 }
22
23 public void DestroyNow()
24 {
25 Destroy(gameObject);
26 }
27}
static GameObject EpilepsyFixer