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
Hi,

I'm working in Unity 5.2.1, Wwise 2015.1.2 on Unity's "Into the Space" Demo project (https://www.assetstore.unity3d.com/en/#!/content/20749).  The game is a basic galaga clone, you control a player ship while enemy ships drop down the screen.

 

I have a space engine sound (Wwise pink noise generator, if it matters) I'm trying to pan based on the position an enemy ship is instantiated on the X-axis.

I've set up a "RedShipPanning" Game Parameter which takes the ship's X-axis coordinate on start (I'll post the code below), this has a min/max value of -6/6 and defaults to zero (based off Unity's coordinates).  This parameter modifies the 2D panning RTPC on the engine sound itself, and does so just fine for a single object on the screen at a time.

 

However when a 2nd red ship is instantiated, the existing RTPC's value changes to match with the new ship's X-axis coordinate instead of having the RTPC act on a per-object basis.  So a ship to the right 3/4 the way down the screen suddenly jumps to the left as a new ship appears on that side at the top of the screen.  Super annoying.  Am I confusing how RTPC's should actually behave?  It's like they're acting as a mix buss instead of an effect on a specific object.

 

Here is the Unity code:

// Use this for initialization
    void Start ()
    {
        GetComponent<Rigidbody2D>().velocity = -1 * transform.up * speed;    //Enemy Ship Movement
        AkSoundEngine.SetRTPCValue ("RedShipPanning", transform.position.x); //Set Wwise's "RedShipPanning" RTPC value based on the ship's initial x-coordinate
    }

 

I have also attempted to add an object ID to the SetRTPCValue code, and this hasn't changed anything.

 

A friend mentioned this might be an issue to the game object being cloned in Unity - but I'm unfamiliar with exactly how that process works and affects Wwise.

 

Halp!  Thanks :)
in General Discussion by Adam C. (230 points)

1 Answer

0 votes

FYI I solved my issue by RTFMing and paying closer attention to MonoDevelop's help dialogues.

AkSoundEngine.SetRTPCValue takes 3 arguments - 1) RTPC name, 2) Value you wish to set, 3) GameObject to set the RTPC on.

In my case, being within the "EnemyRed_Script.cs" file that instantiated the Red Ship game object - my code ended up like this:

AkSoundEngine.SetRTPCValue ("RedShipPanning", transform.position.x, gameObject);

KISS principle ya'll.

 

FYI: If you do not add a valid gameObject in the 3rd argument - the RTPC value defaults globally to ALL gameObjects of said type.  This will cause all sorts of bad wonk, and is what happened to me.

by Adam C. (230 points)
...