https://docs.unity3d.com/kr/530/ScriptReference/Microphone.Start.html
Unity - 스크립팅 API: Microphone.Start
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. 닫기
docs.unity3d.com
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Mic : MonoBehaviour
{
public AudioSource mic; //마이크로 녹음된 소리를 재생할 오디오소스 컴포넌트
void Start()
{
//오디오 소스 클립에 마이크값을 지정
mic.clip = Microphone.Start(Microphone.devices[0].ToString(), true, 1, 44100);
//딜레이를 줄이기 위해 추가한 코드
while (!(Microphone.GetPosition(null) > 0)) { }
//마이크 녹음 재생
mic.Play();
}
}
오디오 소스 컴포넌트에 Loop을 체크해야할수도 있음
'툴 > 유니티' 카테고리의 다른 글
유니티 게임 일시정지 기능 만들기 (0) | 2022.01.11 |
---|---|
Webgl에서 Canvas Button의 OnClick()기능으로 CursorLockMode제어 문제 (0) | 2021.11.12 |
유니티 오디오 스펙트럼 (0) | 2021.10.26 |
앱 이름 한글설정/국가별 설정 (0) | 2021.10.04 |
URP , HDRP에서 VideoPlayer의 Material Override문제 (0) | 2021.09.15 |