사운드 Pause / UnPause
Unity 2017.1 Version 이후부터는
AudioSource.Pause라는 기능과 UnPause라는 기능이 추가되었다.
그 전에는 직접 구현했었어야하는데. 편리해졌다.
기존에는 Pause라는 순간에 해당 Audio 의 time을 저장하고 멈추고 난 이후에 UnPause 시점에서
Audio time을 셋팅해주고 Play를 시켰었다.
지금은 단순하게 Pause / UnPause를 호출해주기만 하면 된다.
public void PauseSound(AudioSource _audioSource)
{
_audioSource.Pause();
}
public void UnPauseSound(AudioSource _audioSource)
{
_audioSource.UnPause();
}
AudioSource.Pause : [링크]
Unity - Scripting API: AudioSource.Pause
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
docs.unity3d.com
AudioSource UnPause : [링크]
Unity - Scripting API: AudioSource.UnPause
This function is similar to calling Play() on a paused AudioSource, except that it will not create a new playback voice if it is not currently paused. This is also useful if you have paused one-shots and want to resume playback without creating a new playb
docs.unity3d.com
★☆☆☆☆
'개발 > Unity' 카테고리의 다른 글
Unity)Tile Animation 적용하기 (Animated Tile) (0) | 2022.10.28 |
---|---|
Unity) Android Log Cat 사용방법 (0) | 2022.10.25 |
Unity)Android) 설치된 Android SDK 확인 방법 (0) | 2022.10.24 |
Unity) UPM(Unity Pacakage Manager)특정 버전 선택하기(Git Dependencies) (0) | 2022.10.23 |
Unity) Texture Format (플랫폼 별 효율적인 텍스처 압축 포맷) (0) | 2022.10.20 |
댓글