La section Questions et réponses de la communauté Audiokinetic est un forum où les utilisateurs de Wwise et de Strata peuvent poser des questions et répondre à celles des autres membres de la communauté. Si vous souhaitez obtenir une réponse de la part de l'équipe de soutien technique d'Audiokinetic, veillez à utiliser le formulaire de Tickets de Soutien.

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

 

 

demandé 30-Jan-2023 dans General Discussion par Tom D. (180 points)

1 Réponse

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. 

répondu 31-Jan-2023 par Mads Maretty S. (Audiokinetic) (39,400 points)
...