snakes_mp/Assets/Scripts/Utils/DestroyAfterTime.cs

24 lines
392 B
C#

using System.Collections;
using System.Collections.Generic;
using Mirror;
using UnityEngine;
public class DestroyAfterTime : MonoBehaviour
{
public float timer = 2f;
void Start()
{
}
void Update()
{
if(timer > 0){
timer-=Time.deltaTime;
return;
}else{
NetworkServer.Destroy(gameObject);
}
}
}