AudioSource.pitch 音调


var pitch : float

Description描述

The pitch of the audio source.

音频源的音调。

  • C#

  • JavaScript

using UnityEngine;using System.Collections;public class example : MonoBehaviour {public int startingPitch = 4;public int timeToDecrease = 5;void Start() {audio.pitch = startingPitch;}void Update() {if (audio.pitch > 0)audio.pitch -= Time.deltaTime * startingPitch / timeToDecrease;}}
// Decreases the pitch in the given seconds//在给定的秒数降低音调var startingPitch = 4;var timeToDecrease = 5;function Start() {audio.pitch = startingPitch;}function Update() {if(audio.pitch > 0)audio.pitch -= ((Time.deltaTime * startingPitch) / timeToDecrease);}


,