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.

How can I access RTPC game parameters in Unity?

0 votes
Hello all,

 

I've made an RTPC in my Wwise project and am wondering how to access this in Unity - is there some kind of template script in the integration that I'm missing?

 

Thanks!
asked Jul 10, 2014 in General Discussion by Tim A. (100 points)

3 Answers

0 votes
Hi Tim,

 

You can use the scripts that come with the wwise integration such as AkState and AkSwitch.

Those scripts provide a base, so you'll have to enter the state/switch group and value names and IDs in the script.

 

Arnaud.
answered Jul 10, 2014 by Arnaud B. (310 points)
0 votes
Hello again!

 

For RTPC's you'll need to call the SetRTPCValue() function in your script.

 

Arnaud
answered Jul 10, 2014 by Arnaud B. (310 points)
Ah! That's great - thank you :)
+1 vote

You can use this:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RTPCListener : MonoBehaviour {


    //set your RTPCID to the name of your desired gameparameter (under GameSyncs)
    public string rtpcID;

    // Update is called once per frame
    void Update () {

        // RTPCValue_type.RTPCValue_Global
        // for whatever reason, this constant isn't exposed by name by WWise C#/Unity headers
        int type = 1;

        // will contain the value of the RTPC parameter after the GetRTPCValue call
        float value;

        // retrieves current value of the RTPC parameter and stores it in 'value'
        AkSoundEngine.GetRTPCValue( rtpcID, gameObject, 0, out value, ref type );

        //
        // use 'value' here
        //
        // e.g. transform.localScale += Vector3( value, 0, 0 );
        // which would scale by the value of the RTPC parameter
}

answered Jan 19, 2018 by Kristina W. (490 points)
...