From 8263edd59284aba390aca011d25b79efecef4c48 Mon Sep 17 00:00:00 2001 From: pryazha Date: Wed, 2 Jul 2025 08:46:23 -0700 Subject: init --- .../3.1.2/Starter Assets/Scripts/DestroySelf.cs | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Assets/Samples/XR Interaction Toolkit/3.1.2/Starter Assets/Scripts/DestroySelf.cs (limited to 'Assets/Samples/XR Interaction Toolkit/3.1.2/Starter Assets/Scripts/DestroySelf.cs') diff --git a/Assets/Samples/XR Interaction Toolkit/3.1.2/Starter Assets/Scripts/DestroySelf.cs b/Assets/Samples/XR Interaction Toolkit/3.1.2/Starter Assets/Scripts/DestroySelf.cs new file mode 100644 index 0000000..f10ffc4 --- /dev/null +++ b/Assets/Samples/XR Interaction Toolkit/3.1.2/Starter Assets/Scripts/DestroySelf.cs @@ -0,0 +1,29 @@ +namespace UnityEngine.XR.Interaction.Toolkit.Samples.StarterAssets +{ + /// + /// Destroys the GameObject it is attached to after a specified amount of time. + /// + public class DestroySelf : MonoBehaviour + { + [SerializeField] + [Tooltip("The amount of time, in seconds, to wait after Start before destroying the GameObject.")] + float m_Lifetime = 0.25f; + + /// + /// The amount of time, in seconds, to wait after Start before destroying the GameObject. + /// + public float lifetime + { + get => m_Lifetime; + set => m_Lifetime = value; + } + + /// + /// See . + /// + void Start() + { + Destroy(gameObject, m_Lifetime); + } + } +} -- cgit v1.2.3-70-g09d2