Community Q&A

Welcome to Audiokinetic’s community-driven Q&A forum. This is the place where Wwise and Strata users help each other out. For direct help from our team, please use the Support Tickets page. To report a bug, use the Bug Report option in the Audiokinetic Launcher. (Note that Bug Reports submitted to the Q&A forum will be rejected. Using our dedicated Bug Report system ensures your report is seen by the right people and has the best chance of being fixed.)

To get the best answers quickly, follow these tips when posting a question:

  • Be Specific: What are you trying to achieve, or what specific issue are you running into?
  • Include Key Details: Include details like your Wwise and game engine versions, operating system, etc.
  • Explain What You've Tried: Let others know what troubleshooting steps you've already taken.
  • Focus on the Facts: Describe the technical facts of your issue. Focusing on the problem helps others find a solution quickly.

0 votes
Problem with silence in interactive music using switches in Unity

Nice to meet you.
I would like to use Wwise's Switch on an enemy object in Unity to switch songs.

I have attached a Collider to the Enemy object, and InTrigger to switch the Switch when the Player object gets in range.
However, when the Player enters the range, the song switches, but when the Player goes out of range, the song is silent.

EventName is BGM and SwitchGroup is Field, switch is Nomal_Field and Enemy_Field.
To explain with switches, I want Unity to switch to Nomal_Field when playing, Enemy_Field when in range of an enemy, and Nomal_Field when out of range of an enemy.

The current situation is as follows
Unity version:2022.3.35f1
Wwise Version:2023.1.5.8522

WwiseGlobal
AkEvent→Trigger On:Start, Name:BGM
AkSwitch→Trigger On:Start, Name;Field/Nomal_Field
AkGameObj→Attenuation Scaling Factor:1, Only Use DefaulListeners is checked

Enemy Objects
WwiseSwitch.cs

using System.Collections;.
Generic; using System.Collections.
Generic; using UnityEngine; using UnityEngine.

public class WwiseSwitch : MonoBehaviour
{
    public GameObject SwitchGameobject; public string EnemyFieldSwitchName = EnemyFieldSwitchName
    public string EnemyFieldSwitchName = “Enemy_Field”;
    public string NormalFieldSwitchName = “Normal_Field”;

    // Start is called before the first frame update
    void Start()
    {
       
    }

    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == “Player”)
        {
            
            AkSoundEngine.SetSwitch(“Field”, EnemyFieldSwitchName, SwitchGameobject); }
           
        }
    }

    private void OnTriggerExit(Collider other)
    {
        if (other.tag == “Player”)
        {
            AkSoundEngine.SetSwitch(“Field”, NormalFieldSwitchName, SwitchGameobject); }
           
        }
    }
}

Anything I'm missing, please ask.
Thank you in advance for your response.
in General Discussion by 遥大 本間 (100 points)

Please sign-in or register to answer this question.

...