menu
Wwise
arrow_drop_down
Strata
arrow_drop_down
Solutions
arrow_drop_down
Apprendre
arrow_drop_down
Communauté
arrow_drop_down
Documentation
arrow_drop_down
Aide
arrow_drop_down
2024.1.5.8803
2023.1.13.8732
2022.1.19.8584
2021.1.14.8108
2019.2.15.7667
2019.1.11.7296
2018.1.11.6987
2017.2.10.6745
2017.1.9.6501
2016.2.6.6153
2015.1.9.5624
Wwise Unity Integration Documentation
|
In most Wwise components for Unity, there is a "Trigger On" property from which you can select which Unity notification/event will trigger the Wwise component (Event, Switch, State, etc.). This list contain only a subset of what is possible in Unity. However, the triggering system is extensible, without modifying the Integration code itself.
To add a new trigger, you simply have to write a C# class that derives from AkTriggerBase. All classes derived from AkTriggerBase will be found through reflection and added to the "Trigger On" drop list. This class contains a delegate, triggerDelegate(GameObject in_target), that you must call when the conditions for your trigger occur. The "target" object is optional and currently used to give collided objects when used with Colliders. This allows Wwise components to post Events on the "collidee" instead of the Collider.
While entirely optional, you could use this system to trigger audio components from your game code too. You can simply call GetComponent<YourTriggerClass>()
.triggerDelegate(GameObject in_target) from your code whenever your trigger condition occurs (or have a custom function).
info | Note: | Currently the maximum number of derivative classes of AkTriggerBase is 32. |
Here is an example with a custom function:
From your game code, you could have this code:
Any Wwise component linked to the TriggerOnGunHit trigger would then do its job. Note that in many simple situations, this is completely superfluous; you could also simply call the base Wwise SDK through AkSoundEngine.PostEvent
("GunHit", gameObject) and let the sound designer handle the effect of this Event in Wwise.
Des questions ? Des problèmes ? Besoin de plus d'informations ? Contactez-nous, nous pouvons vous aider !
Visitez notre page d'AideEnregistrez votre projet et nous vous aiderons à démarrer sans aucune obligation !
Partir du bon pied avec Wwise