3DTD/Assets/Scripts/Utilities/Spawn.cs

17 lines
377 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Spawn : MonoBehaviour
{
[SerializeField] GameObject prefab;
public float desrtoyAfter = 10f;
public void SpawnNow()
{
var go = Instantiate(prefab);
go.transform.position = transform.position;
Destroy(go, desrtoyAfter);
}
}