Hi all
I am new bie to unity. I have a button. When the button is clicked the 10 buttons will be instantiate in the Grid.I have done it
public GameObject yourGridLayout;
//Here i put on click but you need to put your method.
void OnClick(){
for(int i = 0; i < list.Count; i++){
var buttonInstantiate = Instantiate(button);
buttonInstantiate.text = list[i];
buttonInstantiate.transform.gameObject.parent = yourGridLayout.transform;
}
}
. I have a problem in this. if i have pressed button Each and every time the button is instantaiate once again. Once again the 10 button is created. So i have 20 buttons in the grid. Like that it is increasing.
i Have to avoid this.
How can i make the condition the instantiated button should created once. after that if i clicked the button should not instantiated.
how can i do it…