28 lines
418 B
C#
28 lines
418 B
C#
using UnityEngine;
|
|
|
|
public class DestroyAfterSM : MonoBehaviour
|
|
{
|
|
public float stayTime = 10f;
|
|
|
|
private float currenttime;
|
|
|
|
private bool gameStartItem;
|
|
|
|
private void Start()
|
|
{
|
|
if (Time.fixedTime < 1f)
|
|
{
|
|
gameStartItem = true;
|
|
}
|
|
currenttime = Time.fixedTime;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if ((Time.fixedTime - currenttime > stayTime) & !gameStartItem)
|
|
{
|
|
Object.Destroy(base.gameObject);
|
|
}
|
|
}
|
|
}
|