Community Q&A

Where Wwise users help each other out!

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

Using key input to call wwise events in unity

0 votes
I am able to call an event i created which changes a RTPC value, but only when i attach this event to a game object. I cant figure out how to call, activate, this event  with key input.

Any ideas what i need to declare or set? Im not familiar with the AK. api.

Thanks in advance.
asked Nov 6, 2016 in General Discussion by ian s. (100 points)

1 Answer

0 votes

You need some scripts, No No NO don't run, take it easy.

Create a new script, attach it to an empty gameobject 

Imagine this gameobject is your keys input manager. 

Script:

using UnityEngine;             // mandatory
using System.Collections;  // mandatory... i think

public class test : MonoBehaviour {        // NAME OF THE CLASS MUST BE THE SAME AS THE FILENAME; Here; test.cs

    void Update () {                     // Called each frame
        float rtpcValueToSend = 22;     // set the rtpc as you which, value is declared as a float, no need to write 22f
        if (Input.GetKey ("up")) {        // will execute the next commands in {} if the up key is pressed
            AkSoundEngine.SetRTPCValue ("nameofyourrtpc", rtpcValueToSend); // send rtpc to wwise
        }
    }
}

 

 You should look at AkSoundEngine class, most functions are called with this class,

for example, AksoundEngine.PostEvent("play_Footstep, gameObject) 

answered Nov 15, 2016 by olivier h. (290 points)
edited Nov 16, 2016 by olivier h.
...