using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine; using UnityEngine.UI; public class DeleteVisible : MonoBehaviour { // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { } public void setDeleteVisible() { GameObject parent = GameObject.Find("Canvas"); Transform[] children = parent.GetComponentsInChildren(true); foreach(Transform ch in children) { if(ch.gameObject.name == "DeleteButton") { ch.gameObject.SetActive(true); } } } public void setDeleteNonVisible() { GameObject parent = GameObject.Find("Canvas"); Transform[] children = parent.GetComponentsInChildren(true); foreach(Transform ch in children) { if(ch.gameObject.name == "DeleteButton") { ch.gameObject.SetActive(false); } } } }