using System.Collections; using System.Collections.Generic; using UnityEngine; public class DeleteManager : MonoBehaviour { private GameObject gameObject; // Start is called before the first frame update void Start() { gameObject = null; } // Update is called once per frame void Update() { } public void SetObjectToDelete(GameObject toDelete) { this.gameObject = toDelete; } public void DeleteGameObject() { if(gameObject != null) { Destroy(this.gameObject); } } }