Audiokinetic's Community Q&A is the forum where users can ask and answer questions within the Wwise and Strata communities. If you would like to get an answer from Audiokinetic's Technical support team, make sure you use the Support Tickets page.

No Valid Switch - Unity Error

0 votes
Hello audiophiles

When I drag my switch event onto a game object in unity, as well as the AKSwitch script, and play the game the error "No Valid Switch" comes up.

Can anyone explain this to me, is it something I'm not doing in Unity, or is it something that I've missed in the Wwise program ?

 

Thanks!

 

Arnaud
asked Jul 16, 2014 in General Discussion by Arnaud B. (310 points)

1 Answer

0 votes

In Wwise, Make sure your Switch Container is assigned to a switch group:

  • In the Property Editor for your Switch Container, under "Switch Type", assign a switch group, and a default Switch/State
  • In the Contents Editor, assign children to Switches (under "Assigned Objects")
  • Re-generate your SoundBanks

For more information on Switches, you can refer to the Wwise help (In Wwise Authoring: Help > Wwise Help), under Wwise Help > Using Sounds and Motion to Enhance Gameplay > Defining Object Playback Behaviors > Defining the Contents and Behavior of Switch Containers

answered Jul 17, 2014 by Benoit S. (Audiokinetic) (16,020 points)
I've done exactly that and I still get the error.
I've tried with various projects in Wwwise and in Unity. Can't seem to get past this error... Any other ideas?

Thanks for the help Benoit!
Here is a bit of the process I would you to verify things on the way to the game.

Verify Sound Object Assigned for Switch Type: Switch in Actor Mixer.
Verify (correct) Switch Container added as an Event Action to Event.
Verify Event has been included in the Soundbank.
Verify Events/ Structures for the Switch Container/ Event that the Switch
-Make sure all Structures are included.
-Make sure all Media is included.
Verify the Soundbank is getting updated with your changes.
Verify the Soundbank is being loaded by your Unity Project.
-Must exist in correct location within (Streaming Assets)
-Run Game in Unity Editor, Connect Wwise, Profile F6 (Soundbanks Tab).
Verify Event can be triggered while connected.
-Do other switches work?
-If you add a sound to the Event with no switch, does it work?
-What are the errors in the Profiler?
How is the AKSwitch being executed by Unity? (in code, OnStart, OnAwake, etc)

You're almost there, keep at it!
-lcl
Hi Damian

Thanks a lot for help. I went through everything you mentioned and the switches work now!
There were a few things I was doing wrong, using the profiler in Wwise is extremely helpful.
The sounds were actually working when just played in the events, it's the switches that were causing a problem. Somehow I wasn't using them correctly and they weren't compiled in the right way either.
Anyway. All good now. Got a beautiful footstep switch now and will definitely use switches for other sounds as well. They're great!

Even though everything is working fine now, I am wondering if I am doing it the mist efficient way. As I'm sure there must be a few different ways to get these switches to work.
I currently have 2 AKSwitchs on my floor collider:
1- OnTriggerEnter + tag.player + keydownW, that triggers a Walk switch.

2- Update, that triggers a Surface_Snow switch on Update.

I then have the AKEvent that containes the footstep switch on the floor collider, that triggers when I enter the collider.

Is this correct?

Thanks a lot again!

Arnaud
...