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