How to destroy a instantiated buton ?

Hello, i have a problem with my script i can’t resolve.

A buton is instantiated if conditions are met, and then disappear when clicked.
The buton instantiated is customizable in the script (his text and so on).

I use this command to instantiate : butonInstantiated= Instantiate (prefabButon)

Problem : i can’t customize it if i can’t “find” his text, so i use : butonInstantiated.Find (“His name in the prefab”).GetComponent (); to edit its text in the script.

But this line doesn’t work if “butonIstantiated” is a GameObject, Unity displays this error : “Assets/Scripts/Scripts �tape 3/Test_initiate.cs(35,51): error CS0176: Static member `UnityEngine.GameObject.Find(string)’ cannot be accessed with an instance reference, qualify it with a type name instead

But if i make butonIstantiated a Transform, it can’t be destroyed as it says “Can’t remove RectTransform because Image (Script) depends on it

So i’m stuck. :confused:

Any suggestions ?

there can be many solutions, but if you want to change the text of the buttonInstantiated, you can easily do it like this:
insert this line just below the instantiated code:
butonInstantiated.transform.GetComponentInChildern().text = “your text”;

also note: add this header file: Using UnityEngine.UI;

If you know the exact names
you can do it like this
GameObject Go = GameObject.Find(“parentname/childname”);