1
0
mirror of https://projects.caleb-brown.dev/UDRI-XRT/UDRIGEEKCup2024.git synced 2025-01-31 03:22:50 -05:00
2024-04-05 11:33:14 -04:00

29 lines
859 B
C#

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);
}
}
}