AudioClip.length 长度
var length : float
Description描述
The length of the audio clip in seconds (Read Only)
以秒为单位,音频剪辑的长度。(只读)
C#
JavaScript
using UnityEngine;using System.Collections;public class example : MonoBehaviour {public IEnumerator Awake() {audio.Play();yield return new WaitForSeconds(audio.clip.length);}}
audio.Play();// Wait for the audio to have finished//等待音频播放完成yield WaitForSeconds (audio.clip.length);