社区问答

欢迎来到 Audiokinetic 社区问答论坛。在此,Wwise 和 Strata 用户可互帮互助。如需我们团队直接提供协助,请前往技术支持申请单页面。若要报告问题,请在 Audiokinetic Launcher 中选择“报告错误”选项(注意,问答论坛并不会接收错误报告)。我们内部设有专门的错误报告系统,会有专人查看报告并设法解决问题。

要想尽快得到满意的解答,请在提问时注意以下几点:

  • 描述尽量具体:比如,想达到什么样的目的,或者具体哪里有问题。
  • 包含关键细节:比如,Wwise 和游戏引擎版本以及所用操作系统等等。
  • 阐明所做努力:阐明自己为了排除故障都采取了哪些措施。
  • 聚焦问题本身:聚焦于问题本身的相关技术细节,以便别人可以快速找到解决方案。

0 投票

Hello, I just finished the Wwise tutorial on the website and am trying to practice setting up footsteps with Unity. However I am having trouble to make the surface switches work. 

I'm using the John Lemon game as practice project, and I'm trying to set up footstep switches to respond to the different surfaces he is walking on (wood, carpet, etc.). 

 

What I've done so far:

1. Added a PostWwiseEvent script to the player character John Lemon.

public class PostWwiseEvent : MonoBehaviour
{
    public AK.Wwise.Event MyEvent;
    // Start is called before the first frame update
    public void PlayFootstepSound()
    {
   
        MyEvent.Post(gameObject);   
    }

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

 

2. Attached events and assigned PlayFootstepSound() to John Lemon's walking animation.

3. Added colliders to the carpets/rugs on the map, added components to each of them: 2 AkSwitch (Trigger on Enter and Exit), Ak Trigger Enter, and Ak Trigger Exit.

--Is Trigger is checked; Switch is set to my surface switches in Wwise; Trigger Object is set to John Lemon.

 

However, when I test play, only the default footstep (wood) sound would play. I connected to the profiler and saw only 2 entries related to switch at the beginning:

    Timestamp    Type    Description    Object Name    Game Object Name    Object ID    Game Object ID    Scope

    0:00:14.229    Switch    Switch to "Carpet"    Surface    JohnLemon    1834394558    18030    Game Object

    0:00:15.189    Switch    Switch to "Wood"    Surface    JohnLemon    1834394558    18030    Game Object
 

 

I think I'm missing something to tell Unity to get the switch value, but I don't know how to do that. 

Could someone help me? I've been looking all over for this, and tried to follow some tutorial videos but none has worked so far.

Thank you very much. 

 

 

 

 

 

 

 

问题关闭原因: In the end (out of frustration), I deleted everything and reset the cube colliders, somehow it is working now!
分类:General Discussion | 用户: C.c. (100 分)
已关闭 用户:Mads Maretty (Audiokinetic)

1个回答

0 投票

Hi Cc, 

Did you ensure that the Switch + Event is posted on the same game object? What game object does it show in the Capture log for posting the Event? 

If that doesn't reveal the problem, maybe you could try creating new script on the trigger with a OnTriggerEnter function and set the Switch from there. Something like...

private void OnTriggerEnter(Collider other){
    if (other.gameObject.CompareTag("Trigger")){
        // Set switch
        Debug.Log("Switch set");
    }
}

That way, you can use prints (or debug.log) to see how far the call gets whenever something enters the trigger. 

用户: Mads Maretty S. (Audiokinetic) (40.2k 分)
Hi Mads, thank you so much for responding.

I'm still not sure what went wrong, but to answer your question, both the switch and event were posted on the same game object (John Lemon) in the Capture Log. It was not switching during gameplay and the messages seem to only appear in the beginning.

I tried adding the script as you suggested (on the carpet), same problem persists except that the switches were posted on transport/soundcaster instead.

In the end (out of frustration), I deleted everything and reset the cube colliders, somehow it is working now!

Anyway, thanks again for your time and help!
Glad to hear it Cc. Let us know if you get the same problem or figure out what the problem was.
...