Exemplo n.º 1
0
    void OnEnable()
    {
        for (int i = 0; i < contentView.transform.childCount; i++)
        {
            Destroy(contentView.transform.GetChild(i).gameObject);
        }

        researchHandler.RefreshResearchTree();
        foreach (ResearchItem researchItem in researchHandler.AvailableResearch())
        {
            GameObject button = Instantiate(researchButton);
            button.transform.SetParent(contentView.transform);
            button.GetComponentInChildren <Text>().text         = researchItem.title;
            button.GetComponent <ResearchButton>().researchItem = researchItem;
        }
    }