Exemple #1
0
    // Start is called before the first frame update
    void Start()
    {
        Button upgradesButton    = upgradesButtonHolder.GetComponent <Button>();
        Button attachmentsButton = attachmentsButtonHolder.GetComponent <Button>();
        Button selectedButton    = upgradesButton;

        RadioButtonGroup.RadioButtonPressed(upgradesButton, selectedButton);
        attachmentsItemGroup.SetActive(false);

        upgradesButton.onClick.AddListener(() => {
            RadioButtonGroup.RadioButtonPressed(upgradesButton, selectedButton);
            selectedButton = upgradesButton;
            attachmentsItemGroup.SetActive(false);
            upgradesItemGroup.SetActive(true);
        });

        attachmentsButton.onClick.AddListener(() => {
            RadioButtonGroup.RadioButtonPressed(attachmentsButton, selectedButton);
            selectedButton = attachmentsButton;
            upgradesItemGroup.SetActive(false);
            attachmentsItemGroup.SetActive(true);
        });
    }