<aside> 📄 This script plays an AudioClip when a sprite is clicked on with left mouse button.
using UnityEngine;
public class SpriteClickSound : MonoBehaviour
{
private AudioSource audioSource;
void Start()
{
audioSource = GetComponent<AudioSource>();
}
void OnMouseDown()
{
audioSource.Play(); // Play the sound when the sprite is clicked
}
}
</aside>