Version: 5.3 (switch to 5.4b)
언어English
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

AudioSource.time

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.

닫기

Submission failed

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

닫기

취소

Switch to Manual
public var time: float;
public float time;

Description

초 단위의 재생 위치를 나타냅니다.

현재 재생 시간을 읽을 때 사용하거나 새로운 재생 시간을 찾을 때 사용합니다.

Be aware that: On a compressed audio track position does not necessary reflect the actual time in the track
Compressed audio is represented as a set of so-called packets.
패킷의 길이는 압축 설정(compression setting)에 따라 다르고 패킷마다 2-3초정도 다릅니다. See Also: timeSamples 변수입니다.


        
	using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { AudioSource audio; void Start() { audio = GetComponent<AudioSource>(); } void Update() { if (Input.GetKeyDown(KeyCode.Return)) { audio.Stop(); audio.Play(); } Debug.Log(audio.time); } }