Table des matières
Inside the dark forest in the Woodlands, you pass by a small wooden cabin. Curiously you look inside and notice that the comprehensive soundscape of the Woodlands easily gets dampened by the thick wooden walls .
Once you've defined and constructed the environment zone triggers in the game, you can control almost any detail from Wwise, such as which sounds should be affected by the environmental reverbs or what kind of effects should the regions have. However, there may be cases where you have an area within another area, such as the Woodlands Cabin inside the Woodlands region, which would ordinarily result in the Wwise objects being routed to multiple aux busses simultaneously. This would result in an acoustic environment inconsistent with the game content, so you will need to control the relative importance of regions to limit the aux bus routing. In the following steps, you will create a separate Aux Environment for the Woodlands Cabin and set all sounds within to exclusively be using the Woodlands Cabin aux bus.
In the Unity menu, go to Audiokinetic > Certification > 301 > Lesson 6 and select Environments inside Environments.
In the Hierarchy, right-click the Aux Environments, then go to 3D Object and select Cube.
For good practice, let's rename the Cube game object.
Right-Click the Cube game object, select Rename, and name it Woodlands Cabin.
In the Inspector > Box Collider, enable Is Trigger.
Each game object in Unity will be positioned by a Transform component found topmost in the Inspector. If you want to position one game object onto the position of another, you can simply copy the values of one Transform component and paste it into another.
You can copy and paste component values from any component to another, as long as they are of the same type or the same script.
Let's now position the Woodlands Cabin game object onto the same position as the Cabin in the Woods, before adjusting its size.
In the Hierarchy, search for Cabin in the Woods and select it.
In the Inspector's Transform component, click the Gear icon and select Copy Component.
In the Hierarchy, make sure to delete the search and then select the Woodlands Cabin game object.
In the Inspector's Transform component, click the Gear icon and select Paste Component Values.
You should now see the cube shape inside the Woodlands Cabin; if not, select it in the hierarchy and press 'F' with your mouse over the Scene view. Next, fit the Woodlands Cabin to the Cabin.
Use the Move tool, Rotate tool, and Scale tool to fit the Woodlands Cabin game object to cover the Cabin in the Woods Mesh.
In the Inspector, disable the Mesh Renderer to make it invisible.
Next, you should add the AkAmbient component, along with the remaining Rigidbody.
Click Add Component, then search for AkEnvironment and select it.
In the AkEnvironment component, click Add Rigidbody.
Lastly, you should assign the AuxBus Name. For this demonstration, let's use the PineForest_Hut Auxiliary Bus which has a somewhat comparable room design.
In the AuxBus Name, go to Auxiliary Busses > Default Work Unit > Master Audio Bus > World > AUX > Region_PineForest, then select PineForest_Hut and click OK.
Let's test the implementation using the Profiler.
In Wwise, go to Layouts and select Profiler.
As you will be moving the Player into the Trigger, let's focus the search to only look at Player sounds. Before you start Profiling, let's set the filter to only monitoring the Player sounds.
In the Advanced Profiler, set the Filter to Actor-Mixer Hierarchy > Default Work Unit > World > Player Work Unit.
Remote Connect to the game, Play the scene, run to the Woodlands Cabin and attack the boxes.
By looking in the Advanced Profiler, you'll see that the Player_WeaponImpact Event is sending to both the Woodlands aux bus and the PineForest_Hut aux bus.
To simulate the small room of the Woodlands Cabin, you should only be sending to the PineForest_Hut aux bus. For that, you can use the Exclude Others feature in the AkEnvironment component, which will prevent sounds in this AkEnvironment from sending to other AkEnvironment Triggers.
In Unity, press ESC to open the WAG menu and click Play again to exit Play mode.
In the Inspector's AkEnvironment, enable Exclude Others.
Enter Play mode, and in Wwise, click Reconnect…
Enter the Woodlands Cabin and attack the boxes again.
In the Advanced Profiler, notice that the Player_WeaponImpact Event is now only sending to the Woodlands Cabin aux bus.