[Unity] 효과음 (카메라 셔터음) 넣기
[1] 효과음 준비
AssetStore에도 카메라 효과음이 올라와있지만 다운받기 전에 들어볼 수 가 없어서,,
https://assetstore.unity.com/packages/audio/sound-fx/camera-sound-fx-32342#content
Camera Sound FX | 음향 효과음 | Unity Asset Store
Layer in the sounds of Camera Sound FX from SoundBits for your next project. Browse all audio options on the Unity Asset Store.
assetstore.unity.com
여기서 들어보고 하나 다운받았어요! ('카메라 써터음 1회 / 5' PICK)
카메라 찰칵 효과음 무료 다운로드
카메라 초점음 1 카메라 초점음 2 카메라 써터음 1회 카메라 써터음 1회 / 2 카메라 써터음 1회 / 3 카메라 써터음 1회 / 4 카메라 써터음 1회 / 5 카메라 써터음 1회 / 6 카메라 써터음 1회 / 7 카메라..
pgtd.tistory.com
[2] Unity
Asset에 효과음 파일을 넣고 카메라 버튼에 AudioSource 컴포넌트를 추가해줍니다.
AudioClip을 넣어준 후, Play On Awake 옵션을 꺼줍니다.
그리고 카메라 버튼에 붙어있는 스크립트로 가서
버튼 눌렀을 때 실행되는 메소드 안에서 audioSource를 Play 시켜줍니다.
public class CaptureController : MonoBehaviour
{
AudioSource audioSoure;
// Start is called before the first frame update
void Start()
{
audioSoure = GetComponent<AudioSource>();
}
// Update is called once per frame
void Update()
{
}
public void CaptureScreen()
{
audioSoure.Play();
...
}
...
}
Game 뷰의 Mute Audio가 안켜져있는 지 확인하고
테스트 해봐주시면 됩니다~