Esempio n. 1
0
    private void createButtons()
    {
        var optionsArray = currentState.GetStateOptions();
        var nextStates   = currentState.GetNextState();

        for (int i = 0; i < optionsArray.Length; i++)
        {
            Button newButton = Instantiate(button);

            //Text buttonText = Instantiate(Options);
            //buttonText.text = optionsArray[i];
            //buttonText.transform.SetParent(newButton.transform, false);
            newButton.GetComponentInChildren <Text>().text = optionsArray[i];
            newButton.onClick.AddListener(ButtonTest);

            newButton.transform.SetParent(buttonContainer.transform, false);
        }
    }