void Start() { input = new InputSlot[3, 3]; if (Output) { if (Output.GetComponent <OutputSlot>()) { input = new InputSlot[3, 3]; } if (Output) { if (Output.GetComponent <OutputSlot>()) { output = Output.GetComponent <OutputSlot>(); } } if (InputContainer) { int i = 0; for (int y = 0; y < 3; y++) { for (int x = 0; x < 3; x++) { GameObject slotInstance = Instantiate(slotPrefab.gameObject); slotInstance.transform.SetParent(InputContainer); slotInstance.transform.GetComponent <RectTransform>().anchoredPosition3D = Vector3.zero; slotInstance.GetComponent <RectTransform>().sizeDelta = slotPrefab.GetComponent <RectTransform>().sizeDelta; input[x, y] = InputContainer.GetChild(i).GetComponent <InputSlot>(); i++; } } } } }
void Start() { input = new InputSlot[3, 3]; if (Output) { if (Output.GetComponent<OutputSlot>()) input = new InputSlot[3, 3]; if (Output) { if (Output.GetComponent<OutputSlot>()) { output = Output.GetComponent<OutputSlot>(); } } if (InputContainer) { int i = 0; for (int y = 0; y < 3; y++) { for (int x = 0; x < 3; x++) { GameObject slotInstance = Instantiate(slotPrefab.gameObject); slotInstance.transform.SetParent(InputContainer); slotInstance.transform.GetComponent<RectTransform>().anchoredPosition3D = Vector3.zero; slotInstance.GetComponent<RectTransform>().sizeDelta = slotPrefab.GetComponent<RectTransform>().sizeDelta; input[x, y] = InputContainer.GetChild(i).GetComponent<InputSlot>(); i++; } } } } }