AudiokineticのコミュニティQ&AはWwiseやStrataのコミュニティ内でユーザ同士が質問・回答をし合うことができるフォーラムです。Audiokineticテクニカルサポートチームからの回答をご希望の場合は、必ず サポートチケットページ をご利用ください。

0 支持
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!
Tim A. (100 ポイント) General Discussion

回答 3

0 支持
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.
Arnaud B. (310 ポイント)
0 支持
Hello again!

 

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

 

Arnaud
Arnaud B. (310 ポイント)
Ah! That's great - thank you :)
+1 支持

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
}

Kristina W. (490 ポイント)
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!
...