Exemplo n.º 1
0
    private void InstantiateToyButton(BaseToy toy, Transform content)
    {
        var buttonPrefab = Instantiate(BaseToyButtonPrefab);

        buttonPrefab.GetComponent <Button>().onClick.AddListener(() => { m_GameTracker.SelectedBaseToy(toy); });
        buttonPrefab.GetComponentInChildren <Image>().sprite = toy.MySprite;
        buttonPrefab.GetComponentInChildren <Text>().text    = toy.FriendlyName;
        buttonPrefab.transform.SetParent(content);
    }