Save 37% off PRO during our Black Friday Sale! »

1WeekGameJam準備会 ゲームにサウンドをつけてみよう

1WeekGameJam準備会 ゲームにサウンドをつけてみよう

2018/06/03(日) 秋葉原Weeybleで行われた、 Unityもくもく勉強会×1週間ゲームジャム準備会のLT#2です。

88a35446ae16ad3367d2837a30690222?s=128

zarakima

June 03, 2018
Tweet

Transcript

  1. 1WeekGameJam४උձ ήʔϜʹα΢ϯυΛ͚ͭͯΈΑ͏ 2018.6.3 Weeyble Game

  2. ࠓճͷ֓ཁ • ؆୯ͳࣗݾ঺հ • ԻΛग़͢ • α΢ϯυͷ͜ͱ͸͍ͭߟ͑Δʁ • SEͱBGMΛ͍͍ײ͡ʹ͢Δ •

    Ի͕໐Βͳ͍ͱ͖ʙ
  3. ࣗݾ঺հ • zarakima • unityroom: 
 ͍ͨ͋ͨΓΘ͍ͤ͘
 ʢ͓୊: spaceʣ •

    ࠷ۙWeeybleʹΑ͘ग़ೖΓ͍ͯ͠Δਓ
  4. ԻΛग़͢

  5. ԻΛग़͢ ࠷௿ݶɺҎԼͷ3͕ͭඞཁ • AudioClipʢԻݯʣ • Audio Sourceʢίϯϙʔωϯτʣ • Audio Listenerʢίϯϙʔωϯτʣ

  6. AudioClip • Իݯͷૉࡐͷ͜ͱ • AssetsϑΥϧμʹ
 ೖΕ͓ͯ͘ • ΠϯεϖΫλ͔Β
 Ի͕֬ೝͰ͖Δ ࠶ੜͰ͖Δʂ

  7. Audio Source • Իݯ(AudioClip)Λ࠶ੜ
 ͢ΔͨΊͷίϯϙʔωϯτ • ԻΛ໐Β͍ͨ͠ɺ͔ͭ
 ݪଇήʔϜ్தͰফ͑ͳ͍ ήʔϜΦϒδΣΫτʹ
 ͜ͷίϯϙʔωϯτΛ௥Ճ

    ࠶ੜ͍ͨ͠"VEJP$MJQΛ
 ͜͜ʹೖΕΔ
  8. Audio Listener • ԻΛฉͨ͘Ίͷίϯϙʔωϯτʢฉ͖खʣ • ʮγʔϯʹ͚̍ͭͩʯ͋Δ΋ͷ • Main Cameraʹ͚ͭͯ
 ͓͚͹Α͍

  9. ͋ΔλΠϛϯάͰԻΛग़͢ using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class

    SingleSound : MonoBehaviour {
 
 // Կ͔ʹ౰ͨͬͨΒ
 void OnTriggerEnter(Collider other) {
 
 // ԻΛग़͢
 GetComponent<AudioSource>().Play();
 }
 
 }
 AudioSourceʢͱAudioClip)͕௥Ճ͞Ε͍ͯΔήʔϜ ΦϒδΣΫτʹɺҎԼͷεΫϦϓτΛ௥Ճ͢Δ
  10. ෳ਺ͷԻΛग़͢ using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class

    TripleSound : MonoBehaviour {
 
 
 public AudioClip enemySE;
 public AudioClip stoneSE;
 public AudioClip wallSE;
 private AudioSource audioSource;
 
 void Start() {
 audioSource = GetComponent<AudioSource>();
 }
 
 void OnTriggerEnter(Collider other) {
 
 if (other.gameObject.tag == "enemy") {
 audioSource.PlayOneShot(enemySE);
 } else if (other.gameObject.tag == "stone") {
 audioSource.PlayOneShot(stoneSE);
 } else {
 audioSource.PlayOneShot(wallSE);
 }
 
 }
 
 }
  11. α΢ϯυͷ͜ͱ͸ɺ
 ͍ͭߟ͑Δʁ

  12. α΢ϯυͷ͜ͱ͸͍ͭߟ͑Δʁ • ΧοτͱγʔϯɿSEͱBGM • ԻݯΛ୳͢(͕͔͔࣌ؒΔ͔΋) • ԻݯͷϑΥʔϚοτ͸
 ʢࠓճ͸ʣਂ͘ߟ͑ͳͯ͘Α͍

  13. SEͱBGM • SEɿήʔϜ಺ͷग़དྷࣄʹ߹Θͤͯग़͢ޮՌԻ • BGMɿϓϨΠதৗʹྲྀΕ͍ͯΔԻָ • ήʔϜΛʢେͬ͟ͺʹʣઃܭͨ͠ஈ֊Ͱɺ
 SEͱBGMͷ਺͕ʢͬ͘͟Γʣ೺ѲͰ͖Δ

  14. ԻݯΛ୳͢ • ຐԦࠢ
 https://maoudamashii.jokersounds.com/ • ޮՌԻϥϘ
 https://soundeffect-lab.info/ • UnityͪΌΜͷ੠ɿϘΠεύοΫ •

    ʢࠓճ͸ʣཔΊΔʂʂ
  15. ԻݯͷϑΥʔϚοτ • ࠓճ͸୹͍ήʔϜͳͷͰͳΜͰ΋͍͍ • .ogg/.mp3͸ѹॖ͞Ε͓ͯΓɺ࠶ੜ։࢝࣌ʹ CPUͷύϫʔΛ࢖͏ɻ.wav͸ѹॖ͞Ε͍ͯͳ͍ ͷͰ௕͍ԻͷಡΈࠐΈ࣌ʹ͕͔͔࣌ؒΔ܏޲͋Γ

  16. SEͱBGMΛ͍͍ײ͡ʹ͢Δ

  17. SEͱBGMΛ͍͍ײ͡ʹ͢Δ ԻΛઃఆͨ͠ঢ়ଶͰ
 ʮAudio MixerʯΛ࢖͏ • Audio SourceΛάϧʔϓԽ͠ɺ·ͱΊͯѻ͑Δ • ͦΕΛར༻͠ɺSE͕໐ͬͨͱ͖ɺBGMͷԻྔΛ Ұ࣌తʹԼ͛ͨΓͰ͖Δ

  18. Audio MixerΛ࢖͏ • Audio MixerΛͭ͘Δ Create->Audio Mixer • Audio Mixer΢Πϯυ΢Λग़͢


    ϝχϡʔɹWindow->Audio Mixer
  19. Audio MixerΛ࢖͏ • MasterͷԼʹࢠάϧʔϓΛ࡞ΔʢBGM/SEʣ
 BGMͱSE͸ಉ͡֊૚ʹͳΔΑ͏ʹɻ ӈΫϦοΫ
 ʮ"EE$IJME(SPVQʯ

  20. Audio MixerΛ࢖͏ • ඍௐ੔͢Δલʹɺ֤ήʔϜΦϒδΣΫτͷ AudioSourceʮOutputʯʹάϧʔϓΛ
 ઃఆ͓͖ͯ͠·͢ʢ๨Ε΍͍͢ͷͰ஫ҙʂʣ • ͜ͷঢ়ଶͰήʔϜΛ࣮ߦ͠Ի͕໐Δ͜ͱΛ֬ೝ

  21. Audio MixerΛ࢖͏ʢμοΩϯάʣ • SEͷμοΩϯά࠶ੜ
 ʢSEΛ࠶ੜ͢Δͱ͖ɺଞͷԻྔΛߜΔʣ #(.Լͷ"EEΛԡԼ͠
 ʮ%VDL7PMVNFʯΛબ୒

  22. υϥοά͠
 %VDL7PMVNFͷԼ΁ ͖ͭͮ Audio MixerΛ࢖͏ʢμοΩϯάʣ

  23. • SEʹSendΛઃఆ->ΠϯεϖΫλͷઃఆ 4&Լͷ"EEΛԡԼ͠
 ʮ4&/%ʯΛબ୒ Audio MixerΛ࢖͏ʢμοΩϯάʣ

  24. • BGMͷThresholdʢ͖͍͠஋ʣ
 BGMͱSE͕ಉ࣌࠶ੜ͞Ε͍ͯΔͱ͖ɺSEԻྔ͕
 ͜ͷᮢ஋Λ௒͍͑ͯΔؒ͸μοΩϯάΛద༻͢Δ ࠨӈʹυϥοά͠
 ͖͍͠஋Λௐ੔͢Δ Audio MixerΛ࢖͏ʢμοΩϯάʣ

  25. Audio MixerΛ࢖͏ • શମͷϘϦϡʔϜΛௐ੔͢Δ • ήʔϜΛ࣮ߦ͠ɺԻΛฉ͖ͳ͕ΒThresholdͱ
 શମͷϘϦϡʔϜΛඍௐ੔͍ͯ͘͠ͱ͍͍ײ͡ʹ
 ֤߲໨ͷͭ·ΈͰ
 ϘϦϡʔϜௐ੔

  26. Ի͕໐Βͳ͍ͱ͖

  27. Ի͕໐Βͳ͍ͱ͖ • ίϯϙʔωϯτʢAudioSource/ AudioListenerʣ͸෇͍͍ͯΔ͔ʁ • AudioClipΛઃఆ͢Δ৔ॴʢAudioSource΍
 εΫϦϓτͷΠϯεϖΫλʣʹઃఆ͍ͯ͠Δ͔ • AudioMixerΛ࢖༻͍ͯ͠Δ৔߹͸ AudioSourceͷOutput΋֬ೝ

  28. ΋ͬͱৄ͍͠ࢿྉ • Unite2018
 ʮAudioػೳͷجૅͱ࣮૷ςΫχοΫʯ
 https://www.slideshare.net/ UnityTechnologiesJapan002/unite- tokyo-2018audio