summaryrefslogtreecommitdiff
path: root/Assets/Samples/XR Interaction Toolkit/3.1.2/Starter Assets/Scripts/DestroySelf.cs
diff options
context:
space:
mode:
authorpryazha <pryadeiniv@mail.ru>2025-07-02 08:46:23 -0700
committerpryazha <pryadeiniv@mail.ru>2025-07-02 08:46:23 -0700
commit8263edd59284aba390aca011d25b79efecef4c48 (patch)
tree6346e2afaaabd32156601cafaf20d4ee813befaf /Assets/Samples/XR Interaction Toolkit/3.1.2/Starter Assets/Scripts/DestroySelf.cs
Diffstat (limited to 'Assets/Samples/XR Interaction Toolkit/3.1.2/Starter Assets/Scripts/DestroySelf.cs')
-rw-r--r--Assets/Samples/XR Interaction Toolkit/3.1.2/Starter Assets/Scripts/DestroySelf.cs29
1 files changed, 29 insertions, 0 deletions
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
+{
+ /// <summary>
+ /// Destroys the GameObject it is attached to after a specified amount of time.
+ /// </summary>
+ 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;
+
+ /// <summary>
+ /// The amount of time, in seconds, to wait after Start before destroying the GameObject.
+ /// </summary>
+ public float lifetime
+ {
+ get => m_Lifetime;
+ set => m_Lifetime = value;
+ }
+
+ /// <summary>
+ /// See <see cref="MonoBehaviour"/>.
+ /// </summary>
+ void Start()
+ {
+ Destroy(gameObject, m_Lifetime);
+ }
+ }
+}