Destroy Object Simple Code C# Unity

Place this script on a gameobject in Unity and the object will destroy after 3 seconds.

using UnityEngine;
using System.Collections;

public class DestroyObjectSimple : MonoBehaviour
{

    private void Start()
    {
        Destroy(gameObject, 3);
    }
    
}

Leave a comment