using System.Collections; using System.Collections.Generic; using UnityEngine; [RequireComponent(typeof(AudioSource))] public class PitchRandomizer : MonoBehaviour { [Range(0f, 0.1f)] [SerializeField] private float pitchDeviationRange; AudioSource source; private void Awake() { source = GetComponent(); } public void RandomizePitch() { source.pitch = 1 + Random.Range(-pitchDeviationRange, pitchDeviationRange); } }