DeleteManager.cs 598 B

1234567891011121314151617181920212223242526272829303132333435
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class DeleteManager : MonoBehaviour
  5. {
  6. private GameObject gameObject;
  7. // Start is called before the first frame update
  8. void Start()
  9. {
  10. gameObject = null;
  11. }
  12. // Update is called once per frame
  13. void Update()
  14. {
  15. }
  16. public void SetObjectToDelete(GameObject toDelete)
  17. {
  18. this.gameObject = toDelete;
  19. }
  20. public void DeleteGameObject()
  21. {
  22. if(gameObject != null)
  23. {
  24. Destroy(this.gameObject);
  25. }
  26. }
  27. }