PCM 样本中的播放位置。
using UnityEngine; using System.Collections;
[RequireComponent(typeof(AudioSource))] public class ExampleClass : MonoBehaviour { AudioSource audioSource;
void Start() { audioSource = GetComponent<AudioSource>(); }
void Update() { if (Input.GetKeyDown(KeyCode.Return)) { audioSource.Stop(); audioSource.Play(); } Debug.Log(audioSource.timeSamples); } }