26 lines
575 B
C#
26 lines
575 B
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class AutoChapterButton : MonoBehaviour
|
|
{
|
|
public int chapterID; // isi di Inspector (1,2,3,...)
|
|
|
|
void Start()
|
|
{
|
|
Button btn = GetComponent<Button>();
|
|
|
|
btn.onClick.RemoveAllListeners();
|
|
|
|
btn.onClick.AddListener(() =>
|
|
{
|
|
if (ManagerGame.instance != null)
|
|
{
|
|
ManagerGame.instance.SelectChapter(chapterID);
|
|
}
|
|
else
|
|
{
|
|
Debug.LogError("GameManager tidak ditemukan!");
|
|
}
|
|
});
|
|
}
|
|
} |