One Minute Wwise | Play a sound from a key in Unity

How to play a sound from a key on your keyboard in Unity.
No commercials, no lengthy introductions - get "Wwiser" in less than 1 minute!

To play a sound in Unity, when you press a key on your keyboard, you need to:
1. Open your Unity Project.
2. Make a new script with a Wwise-Type property.
3. Create a bit of logic that detects when you press a key on your keyboard.
4. And select the event in the Inspector.
So let's begin. Open your Unity project, and make sure the Wwise project is connected. Go to the Hierarchy and choose where the sound should play from, and add a new PlaySound script on that game object. In the PlaySound class, you write 'public Ak.Wwise.Event', and name it 'SomeSound'. Next, detect when you press a key on your keyboard. So in the Update() function, which runs every frame, write if a key is pressed down, and that key is the spacebar, then post the sound on this game object. Now save the script, select an Event in the PlaySound script and press Play. Now press the spacebar. That's it!

Resources:
* The script with more details: https://github.com/MadsMaretty/OneMinuteWwise/blob/master/Play%20a%20sound%20from%20a%20key%20in%20Unity/PlaySound.cs
* About Wwise Types: https://hubs.ly/H0rFxXj0
* About Unity scripts: https://docs.unity3d.com/Manual/CreatingAndUsingScripts.html
* About If Statements: https://learn.unity.com/tutorial/if-statements
* Creating a Wwise-Type property: https://hubs.ly/H0rFypc0
* About Input.GetButtonDown(): https://docs.unity3d.com/ScriptReference/Input.GetButtonDown.html
* About "public" and other Access Modifiers: https://learn.unity.com/tutorial/scope-and-access-modifiers#5c8a40e9edbc2a001f47ccef
* Video about posting with Wwise Types: https://www.youtube.com/watch?v=8AWRNeIL0U4
* How to connect Unity to your Wwise project: https://www.youtube.com/watch?v=Oin2x0px1kM
* How to post a sound using a component: https://www.youtube.com/watch?v=2XSMtKFbVVY&list=PLXMeprTk4ORPo5PNwc8Wr9F-mgE-qBPUC&index=1

5020 视图

相关视频

11:00

SoundSeed Grain - Product Overview

08:20

Wwise 301 L4-01 | Posting Events from a Script

37:38

Joel Robichaud - Interactive audio plug-in development with the Wwise SDK

相关视频

11:00

SoundSeed Grain - Product Overview

3116 视图
08:20

Wwise 301 L4-01 | Posting Events from a Script

3743 视图