diff options
author | chai <chaifix@163.com> | 2022-04-17 10:24:17 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2022-04-17 10:24:17 +0800 |
commit | ea9cf7843d50f3debf6ea8b5e31976dc7a15f483 (patch) | |
tree | 318a9fe08e188790b27ff99bc4737516a379faa3 /AlienSurvival/Assets/Test/Scripts/TestDestroySelf.cs | |
parent | 0292c4cab3ec686d224da576805478c7e8219865 (diff) |
* grenade
Diffstat (limited to 'AlienSurvival/Assets/Test/Scripts/TestDestroySelf.cs')
-rw-r--r-- | AlienSurvival/Assets/Test/Scripts/TestDestroySelf.cs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/AlienSurvival/Assets/Test/Scripts/TestDestroySelf.cs b/AlienSurvival/Assets/Test/Scripts/TestDestroySelf.cs new file mode 100644 index 0000000..0ab48da --- /dev/null +++ b/AlienSurvival/Assets/Test/Scripts/TestDestroySelf.cs @@ -0,0 +1,20 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class TestDestroySelf : MonoBehaviour +{ + public float lifeTime; + + void Start() + { + Invoke("DestroySelf", lifeTime); + } + + void DestroySelf() + { + this.gameObject.SetActive(false); + Destroy(this.gameObject); + } + +} |