using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; public class ButtonSound : MonoBehaviour, IPointerClickHandler, IPointerEnterHandler { [Header("Resources")] public AudioSource audioObject; [Header("Custom SFX")] public AudioClip hoverSFX; public AudioClip clickSFX; [Header("Settings")] public bool enableHoverSound = true; public bool enableClickSound = true; public bool checkForInteraction = true; private Button sourceButton; void OnEnable() { if (Application.isPlaying == true && audioObject == null) { try { audioObject = GameObject.Find("UI Audio").GetComponent(); } catch { Debug.Log("[UI Element Sound] No Audio Source found.", this); } } if (checkForInteraction == true) { sourceButton = gameObject.GetComponent