jakeHaasBlog / COMP4990_Dimension-Tamer

COMP 4990 Final Project (Jake Haas and Drew St. Amour)
0 stars 0 forks source link

Fix audio bug when going through portal #41

Closed jakeHaasBlog closed 10 months ago

jakeHaasBlog commented 10 months ago

Portal sound effect is cutting off half way through playing

jakeHaasBlog commented 10 months ago

Fixed the problem. The sound was playing in 3D, so when the player was repositioned, they were too far away to hear the sound. Fixed it by playing the audio in 2D using this code:

AudioSource audio = ((GameObject) Instantiate(gameObject, transform.position, Quaternion.identity)).GetComponent<AudioSource>();
audio.clip = soundEffect;
audio.Play();