menu
 

在 Audiokinetic 社区问答论坛上,用户可对 Wwise 和 Strata 相关问题进行提问和解答。如需从 Audiokinetic 技术支持团队获取答复,请务必使用技术支持申请单页面。

0 投票

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"?
 

 

 

分类:General Discussion | 用户: Tom D. (180 分)

1个回答

0 投票

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. 

用户: Mads Maretty S. (Audiokinetic) (40.2k 分)
...