The pitch of the audio source.
#pragma strict @RequireComponent(AudioSource) public var startingPitch = 4; public var timeToDecrease = 5; var audio; function Start() { audio = GetComponent.<AudioSource>(); audio.pitch = startingPitch; } function Update() { if (audio.pitch > 0) audio.pitch -= Time.deltaTime * startingPitch / timeToDecrease; }
using UnityEngine; using System.Collections;
[RequireComponent(typeof(AudioSource))] public class ExampleClass : MonoBehaviour { public int startingPitch = 4; public int timeToDecrease = 5; AudioSource audio; void Start() { audio = GetComponent<AudioSource>(); audio.pitch = startingPitch; } void Update() { if (audio.pitch > 0) audio.pitch -= Time.deltaTime * startingPitch / timeToDecrease; } }