예제 #1
0
    private void InstantiateAttachmentButton(ToyAttachment attachment, Transform content)
    {
        var buttonPrefab = Instantiate(AttachmentButtonPrefab);

        buttonPrefab.GetComponent <Button>().onClick.AddListener(() => { m_GameTracker.AddToyAttachment(attachment); });
        buttonPrefab.GetComponentInChildren <Image>().sprite = attachment.mySprite;
        buttonPrefab.GetComponentInChildren <Text>().text    = attachment.friendlyName;
        buttonPrefab.transform.SetParent(content);
    }