Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Audio 3d Sound in 2d Games? [SOLVED]

Discussion in 'Audio & Video' started by HeathC, Aug 28, 2017.

  1. HeathC

    HeathC

    Joined:
    Oct 17, 2016
    Posts:
    110
    I'm making a 2d game and I want certain things in the room to get louder as you get closer, but using 3d sound doesn't seem to work.

    I've done some googling and found everyone saying set spatial to 3d, change rolloff to linear, and set a min / max... but those steps don't seem to be working in my 2d game... the volume never changes (except for messing with the min, but it's still constant no matter where in the game you are)

    anyone have any experience with 3d sound in 2d games?
     
    Naver78 and datagreed like this.
  2. michaelhartung

    michaelhartung

    Joined:
    Dec 19, 2013
    Posts:
    72
    Hmmm, where's the audio listener positioned in the game? Is it on the character (it sounds as if it's on the camera instead)?
     
    Naver78, DotusX and mruva like this.
  3. HeathC

    HeathC

    Joined:
    Oct 17, 2016
    Posts:
    110
    I moved it from the camera to the player and now 3d audio functions as expected, thank you. I don't understand why it wouldn't work on the camera, and I'll have to rig up a way for the listener to stick around before the player goes back in the pool so there isn't silence during the death particle lingering... but it works. Thank you again.
     
    Naver78 and DotusX like this.
  4. michaelhartung

    michaelhartung

    Joined:
    Dec 19, 2013
    Posts:
    72
    Nice! Glad it solved your problem.
     
  5. HeathC

    HeathC

    Joined:
    Oct 17, 2016
    Posts:
    110
    Super simple solution for the despawned listener issue too. I just added a listener to the death particle, and when the new player spawns from the pool, I disable it on the particle, and when the particle despairs and goes back in the pool, I reenable it so it's ready to go the next time it spawns.