24 lines
438 B
C#
Raw Normal View History

2020-03-05 00:48:39 +01:00
using UnityEngine;
using UnityEngine.Assertions;
using UnityAtoms.BaseAtoms;
public class DestroyMe : MonoBehaviour
{
[SerializeField]
2020-03-11 21:11:27 +01:00
FloatReference _delay = new FloatReference(-1f);
2020-03-05 00:48:39 +01:00
void Start()
{
Assert.IsNotNull(_delay);
2020-03-11 21:11:27 +01:00
if (_delay.Value >= 0f)
{
Destroy(gameObject, _delay.Value);
}
2020-03-05 00:48:39 +01:00
}
public void DestroyImmediate()
{
Destroy(gameObject);
}
}