Example #1
0
    void Start()
    {
        AddItem();
        template.AddComponent <SongItem>();

        for (int i = 0; i < dirCnt; i++)
        {
            GameObject obj   = Instantiate(template);
            SongItem   sItem = obj.GetComponent <SongItem>();

            sItem.songName   = newItems[i].songName;
            sItem.songArtist = newItems[i].songArtist;
            sItem.songLevel  = newItems[i].songLevel;
            sItem.sprite     = newItems[i].sprite;

            items.Add(obj.GetComponent <SongItem>());
        }


        SongDisplay song = (SongDisplay)Instantiate(songDisplayPrefab);

        song.Prime(items);
    }
Example #2
0
    // Inventory.cs
    void Start()
    {
        SongDisplay song = (SongDisplay)Instantiate(songDisplayPrefab);

        song.Prime(items);
    }