반응형
- 코드 작성
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Example : MonoBehaviour
{
public AudioSource audioSource;
public AudioClip audioClip;
private void Start()
{
audioSource.Play(); //재생
audioSource.Stop(); //정지
audioSource.Pause(); //일시정지
audioSource.UnPause(); //일시정지 해제
audioSource.playOnAwake = true; //씬 시작시 바로 재생
audioSource.loop = true; //반복 재생
audioSource.mute = true; //음소거
audioSource.volume = 1.0f; //볼륨 (0.0 ~ 1.0f)
audioSource.PlayOneShot(audioClip, 1.0f); //특정 클립 한번 만 재생
audioSource.clip = audioClip; //오디오 클립 교체
if (audioSource.isPlaying) Debug.Log("오디오 재생중입니다."); //오디오 재생 여부 확인
}
}
참고할만한 글
반응형
'개발 > C#' 카테고리의 다른 글
유니티 C# 비속어 필터 적용 inputfield 간단 사용법 (0) | 2022.07.14 |
---|---|
유니티 C# 디버그 로그 종류 Debug.Log 간단 사용법 (0) | 2022.07.13 |
유니티 C# 자주 사용하는 연산자 Operator 모음 (0) | 2022.07.13 |
유니티 C# 구글 스프레드 시트 Google Sheet 간단 사용법 (0) | 2022.07.13 |
유니티 C# 카메라 흔들기 Camera Shake 간단 사용법 (0) | 2022.07.06 |
유니티 C# 시간 DateTime 출력하기 간단 사용법 (0) | 2022.07.06 |
유니티 C# 코루틴 Coroutine 간단 사용법 (0) | 2022.07.06 |
유니티 C# 스킬 쿨타임 구현 FillAmount 간단 사용법 (0) | 2022.07.06 |
댓글