29 lines
660 B
C#
29 lines
660 B
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class AutoButtonSound : MonoBehaviour
|
|
{
|
|
private void Start()
|
|
{
|
|
PasangSoundKeSemuaButton();
|
|
}
|
|
|
|
public void PasangSoundKeSemuaButton()
|
|
{
|
|
Button[] semuaButton = FindObjectsOfType<Button>(true);
|
|
|
|
foreach (Button btn in semuaButton)
|
|
{
|
|
btn.onClick.RemoveListener(MainkanSoundButton);
|
|
btn.onClick.AddListener(MainkanSoundButton);
|
|
}
|
|
}
|
|
|
|
private void MainkanSoundButton()
|
|
{
|
|
if (AudioManager.instance != null)
|
|
{
|
|
AudioManager.instance.PlayButtonClick();
|
|
}
|
|
}
|
|
} |