[Unity] Audio

박호준·2022년 2월 14일
0

Unity

목록 보기
11/17
  • Play on Awake : 게임 시작시 할지, 스크립트로 시작할지
  • Priority : 재생 순위
  • pitch : 빠르기 (뒤로 재생 가능)
  • Spatial Blend : 멀리있는 소리는 작게

소리 랜덤 재생

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class audio : MonoBehaviour
{
    private AudioSource theAudio;

    [SerializeField] private AudioClip[] clip;

    void Start()
    {
        theAudio = GetComponent<AudioSource>();
    }
    public void PlaySE()
    {
        int _temp = Random.Range(0, 4);

        theAudio.clip = clip[_temp];
        theAudio.Play();
    }
}
profile
hopark

0개의 댓글