Hello everyone, I am brand new to this asset in Unity so I could really use some help that the documentation didn't really help me with. So I have a dialogue that starts with a person snoring. I have a script that starts the snoring and it stops shortly after an alarm plays. The alarm is set to a loop and will continue to play until I select one of two options [Press Snooze] or [Wake up]. The problem is I can't get it to stop at all. I tried looking into Sequences where I found an AudioStop sequence and reference my AlarmStop Method in my c# script but that isn't working. I have it like this AudioStop(SoundManager.AlarmStop); When I select check it shows up green so it looks like it would work. I also found something that said to write it like this [Script(SoundManager.AlarmStop)] but that doesn't work either. Then I read something that said I need to expose my script via Lua. So I added this to my script Lua.RegisterFunction("AlarmStop", this, SymbolExtensions.GetMethodInfo(() => AlarmStop())); and then wrote the sequence like this [Lua(AlarmStop())] and that didn't work either. So I am at a loss and could use some help. How my dialogue is set up is as follows.
1. Snoring audio starts and ZZZZZZZZ shows up in my dialogue the a few seconds later an alarm sounds goes off
2. "Ugh it is morning already" comes up next and I select that to show two options
3. Hit Snooze or Wake up
4. I want both of those to stop the alarm sounds
How to make an audioclip stop when button press
-
- Posts: 3
- Joined: Fri Nov 17, 2023 3:58 pm
-
- Posts: 3
- Joined: Fri Nov 17, 2023 3:58 pm
Re: How to make an audioclip stop when button press
So I changed it to having a game object called Alarm Clock that has an audio source on it. I then use the sequence SendMessage(Stop, ,Alarm Clock) but that isn't working either
-
- Posts: 3
- Joined: Fri Nov 17, 2023 3:58 pm
Re: How to make an audioclip stop when button press
I figured it out. Instead of using SendMessage, which I really want to learn because it seems powerful, I used AudioStop(GameObject), it wasn't working before because I have it set to a script and was trying to use it to call that script instead of just referencing the GameObject