Panel | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
In depth learning on Basic Scene Configuration is found in this course in Motive Academy. |
Excerpt |
---|
Use sound effects to improve the user’s experience of an equippable. |
Table of Contents | |
---|---|
|
...
|
Make Effect Prefabs
Create a set of Prefabs for each sound effect. Making these into Prefabs will allow you to easily re-use these effects. Do this by adding
Add thePlay Sound Effect
...
Script to the Prefab
...
Add as many clips you like. The player will randomly choose a sound from this list when it plays
...
:
...
Attach
...
Effect Prefabs to the Equippable
Attach these Prefabs as children of the Equippable
...
:
...
Connect
...
Events to the
...
Effects
Now we want to wire up the Equippable so that various events Events can trigger these sounds. Most Motive components have a set of events Events that you can attach to.
Picking Up
Connect the Grabbable “On Grab Begin Event”:
...
Equip/Unequip
Connect to the Equippable “On User Equip” and “On User Unequip”
...
Events. (Note that this is slightly different from “On Equip”--”On User Equip” only fires when the user takes an action to equip as opposed to the item being equipped automatically by a Script.):
...
Drop
To handle effects when an item hits the ground, you’ll need to add a Collision Event Handler script to the object. This component fires events when the object processes a collision.
Set a threshold so that the sound effect only plays when the collision has a certain force (otherwise you will notice any disturbance causes the event to fire)
...
Attach to the “Collision Enter” event
...
:
...