gimm270-audioenvironment/Assets/Scripts/ImpactRandomPitch.cs
2022-10-31 00:08:36 -06:00

26 lines
No EOL
489 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ImpactRandomPitch : MonoBehaviour
{
AudioSource source;
public float minPitch = 0.6f;
public float maxPitch = 1.5f;
void Start()
{
source = GetComponent<AudioSource>();
}
private void OnTriggerEnter(Collider collider)
{
source.pitch = Random.Range(minPitch, maxPitch);
source.Play();
// Debug.Log("audio.Play Called");
}
}