在 Audiokinetic 社区问答论坛上,用户可对 Wwise 和 Strata 相关问题进行提问和解答。如需从 Audiokinetic 技术支持团队获取答复,请务必使用技术支持申请单页面。

How can I access RTPC game parameters in Unity?

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!
最新提问 7月 10, 2014 分类:General Discussion | 用户: Tim A. (100 分)

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.
最新回答 7月 10, 2014 用户: Arnaud B. (310 分)
0 投票
Hello again!

 

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

 

Arnaud
最新回答 7月 10, 2014 用户: 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
}

最新回答 1月 19, 2018 用户: 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!
...