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.

Post an event on Awake in UNITY

0 votes

I have had good success posting events in Unity with this line of code when a specific function or event is triggered by a button press etc.

AkSoundEngine.PostEvent("MyEvent", this.gameObject);

This is NOT working when I want the event to start "on AWake"

Here is the script - and I was told to put the event on awake
 

  private void Awake()
    {
        Screen.orientation = ScreenOrientation.LandscapeLeft;

        currentBlimpTarget = blimpEndPoint;

etc.......

Can someone tell me where the AkSoundEngine.PostEvent should go?
Or is there a different line of code I should use for an Event that it to be played "on awake"?
 

 

 

asked Jan 30, 2023 in General Discussion by Tom D. (180 points)

1 Answer

0 votes

Hey Tom, 

Any reason you don't just post the Event in Start()? 
Usually, it's recommended to load SoundBanks in Awake(), then post sounds in Start(). This ensures that the SoundBanks is loaded before you post the Event. 

That said, for these types of problems the Profiler's Capture Log is the best place to go. If you need to connect before the game starts, you can always connect to the IP 127.0.0.1 (your local IP) and upon starting the game, Wwise will automatically find it and connect. 

answered Jan 31, 2023 by Mads Maretty S. (Audiokinetic) (39,060 points)
...