using UnityEngine; using UnityEngine.UI; public class InfoManager : MonoBehaviour { [Header("Content Panels")] public GameObject contentCredit; public GameObject contentRecord; [Header("Button Images")] public Image btnCreditImage; public Image btnRecordImage; [Header("Sprites")] public Sprite creditOn; public Sprite creditOff; public Sprite recordOn; public Sprite recordOff; void OnEnable() { // Paksa kedua tombol aktif secara visual di hierarchy sebelum ganti konten if(btnCreditImage != null) btnCreditImage.gameObject.SetActive(true); if(btnRecordImage != null) btnRecordImage.gameObject.SetActive(true); ShowCredit(); } public void ShowCredit() { // Switch Panel Konten contentCredit.SetActive(true); contentRecord.SetActive(false); // Switch Sprite (Warna) btnCreditImage.sprite = creditOn; btnRecordImage.sprite = recordOff; // RE-CHECK: Pastikan tombolnya tidak mendadak mati btnCreditImage.gameObject.SetActive(true); btnRecordImage.gameObject.SetActive(true); } public void ShowRecord() { contentCredit.SetActive(false); contentRecord.SetActive(true); btnCreditImage.sprite = creditOff; btnRecordImage.sprite = recordOn; btnCreditImage.gameObject.SetActive(true); btnRecordImage.gameObject.SetActive(true); } }