You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PlumberUltimateAds/Assets/ButtonSoundAdder.cs

24 lines
567 B
C#

7 days ago
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ButtonSoundAdder : MonoBehaviour
{
public Button[] AllButtons;
void Start()
{
if (AllButtons.Length == 0)
{
AllButtons = FindObjectsOfType<Button>();
for (int i = 0; i < AllButtons.Length; i++)
{
AllButtons[i].onClick.AddListener(() =>
{
Sound.instance.PlayButton(Sound.Button.Back);
});
}
}
}
}