Author Topic: Fade out Music?  (Read 2577 times)

Whiskan

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 5
    • View Profile
Fade out Music?
« on: November 17, 2014, 08:45:47 AM »
I'm using NGUI with TNet for an online survival game - when I set up my button to Autojoin in my prototype, the music continues to play in the loaded scene.

Is this because the main menu doesn't actually close? I've waited for the music to finish playing but it continues to loop (which is what I want it to do on the main menu only). So I suppose my question is, how do I fade out the music when switching to a new scene?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Fade out Music?
« Reply #1 on: November 17, 2014, 09:25:59 AM »
NGUI is a UI system. TNet is a networking library. Neither has anything to do with music, so I am not sure what your question is about... What are you playing your music with?

Whiskan

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: Fade out Music?
« Reply #2 on: November 17, 2014, 10:01:08 AM »
Sorry, I'll try to be more specific.

I realize NGUI and TNet have nothing to do with the sound; there's just a simple audio source and listener in the menu scene. I suppose I'm trying to understand NGUI and TNet functionality better... or maybe it's unity?

I assumed that by using Autojoin (and when my game scene loads), the menu scene would automatically stop all functions. Is the menu scene running in the background somewhere? Is it a unity issue where the music will just keep playing until I tell it not to? Or does it have to do with the TNet service

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Fade out Music?
« Reply #3 on: November 18, 2014, 05:08:09 AM »
Well again, I don't know what you used to play the music. All AudioSource components will be destroyed unless they were marked as DontDestroyOnLoad. In Windward I purposely left the music on a separate game object that travels from one scene to another so that it doesn't get interrupted.

In any case, this is a question for Unity. As I mentioned neither of the two add-ons has anything to do with music, so everything you do there is all Unity.

Whiskan

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: Fade out Music?
« Reply #4 on: November 19, 2014, 09:56:26 AM »
Alright, thanks!