Version: 2018.2
public void Play (ulong delay= 0);

パラメーター

delayDeprecated. Delay in number of samples, assuming a 44100Hz sample rate (meaning that Play(44100) will delay the playing by exactly 1 sec).

説明

Plays the clip.

遅延パラメーターは非推奨です。代わりに秒単位で遅延を指定する新しい PlayDelayed 関数を使用してください。

If AudioSource.clip is set to the same clip that is playing then the clip will sound like it is re-started. AudioSource will assume any Play call will have a new audio clip to play.

注意: AudioSource.PlayScheduled はオーディオクリップを再生するときに正確な制御を行うことができます。

using UnityEngine;

// The Audio Source component has an AudioClip option. The audio // played in this example comes from AudioClip and is called audioData.

[RequireComponent(typeof(AudioSource))] public class ExampleScript : MonoBehaviour { AudioSource audioData;

void Start() { audioData = GetComponent<AudioSource>(); audioData.Play(0); Debug.Log("started"); }

void OnGUI() { if (GUI.Button(new Rect(10, 70, 150, 30), "Pause")) { audioData.Pause(); Debug.Log("Pause: " + audioData.time); }

if (GUI.Button(new Rect(10, 170, 150, 30), "Continue")) { audioData.UnPause(); } } }

参照: StopPause:: 、 clipPlayScheduled 関数。