Hi,
I’m trying to put button(stored as prefab) dynamically to panel.
I tried many ways, though I don’t understand exactly how it should be done.
public RectTransform panel;
public Button bt;
.
.
.
Instantiate(bt);
bt.transform.SetParent(panel.transform);
I always get this error:
“Setting the parent of a transform which resides in a prefab is disabled to prevent data corruption.”
My question is, how to do it correctly ?