言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

AudioSource.pitch

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual
public var pitch: float;
public float pitch;
public pitch as float

Description

スローダウン・スピードアップのためのピッチ変化量(デフォルトは1)。

	// Decreases the pitch in the given seconds

	var startingPitch = 4;
	var timeToDecrease = 5;
	@script RequireComponent(AudioSource)
	function Start() {
		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;
    void Start() {
        audio.pitch = startingPitch;
    }
    void Update() {
        if (audio.pitch > 0)
            audio.pitch -= Time.deltaTime * startingPitch / timeToDecrease;
        
    }
}
import UnityEngine
import System.Collections

[RequireComponent(typeof(AudioSource))]
public class ExampleClass(MonoBehaviour):

	public startingPitch as int = 4

	public timeToDecrease as int = 5

	def Start() as void:
		audio.pitch = startingPitch

	def Update() as void:
		if audio.pitch > 0:
			audio.pitch -= ((Time.deltaTime * startingPitch) / timeToDecrease)