Audiokinetic's Community Q&A is the forum where users can ask and answer questions within the Wwise and Strata communities. If you would like to get an answer from Audiokinetic's Technical support team, make sure you use the Support Tickets page.

Question about setting up footstep switches [closed]

0 votes

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. 

 

 

 

 

 

 

 

closed with the note: In the end (out of frustration), I deleted everything and reset the cube colliders, somehow it is working now!
asked Jun 1, 2021 in General Discussion by C.c. (100 points)
closed Jun 23, 2021 by Mads Maretty S.

1 Answer

0 votes

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. 

answered Jun 2, 2021 by Mads Maretty S. (Audiokinetic) (38,720 points)
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.
...