Please be advised that the Audiokinetic offices will close at 3:00 p.m. EST on December 23rd, 2019 for the holiday period, and will reopen on January 3rd, 2020 at 9:00 a.m. EST. Learn more.

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)
Would you be able to elaborate more for someone whos barely familiar with c# and still struggling with RTPC implementation?
for example:
what should i exactly replace in ( rtpcID, gameObject, 0, out value, ref type )?i already know that i should replace the rtpcID with the RTPC name in Wwise,i assume gameObject should be left gameObject,but what about out value and ref type?
and what about this?
  // use 'value' here
i would be MORE THAN GRATEFUL for your help,as the RTPC implementation in unity is the only thing i am still struggling with,
thank you!
...