So I am making an inventory system, my current method involves toggles which will be instantiated as children of the toggle group. My question is how can I set the group of an instantiated toggle in a script?
Current script:
public GameObject slot;
public int gap = 2;
public int quantity = 2;
RectTransform slotTransform;
void updateDisplay () {
for (int i=1; i<=quantity; i++) {
slotTransform = slot.GetComponent<RectTransform>();
slotTransform.localPosition = new Vector3(0,-(i-1)*(2+slotTransform.sizeDelta.y));
Instantiate (slot).transform.SetParent (transform,false);
}
}