using UnityEngine; /// /// ThemeSelectionScreen scene manager /// public class ThemeSelectionScreen : MonoBehaviour { /// /// Theme prefab /// public GameObject themePrefab; /// /// Reference to container holding all theme-buttons /// public Transform themesContainer; /// /// Reference to the minigamelist /// public MinigameList minigameList; /// /// Start is called before the first frame update /// void Start() { Minigame minigame = minigameList.minigames[minigameList.currentMinigameIndex]; ThemeList themeList = minigame.themeList; for (int i = 0; i < themeList.themes.Count; i++) { Theme theme = themeList.themes[i]; // First, you need to create a new button game object GameObject instance = GameObject.Instantiate(themePrefab, themesContainer); // Dynamically load appearance ThemeItem item = instance.GetComponent(); item.theme = theme; //item.startGameCallback = () => OnButtonClick(theme.name); } } }