Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class PlaySound : MonoBehaviour
- {
- [SerializeField] AudioClip _clip;
- [SerializeField] AudioSource _source;
- [SerializeField] float _pitch = 1.0f;
- // Start is called before the first frame update
- void Start()
- {
- }
- public void PlayKey()
- {
- _source.pitch = _pitch;
- Debug.Log($"Playing {_clip.name}", this);
- _source.PlayOneShot(_clip);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement