Add Sounds
Read more about sounds in this chapter.
Editor crashes when moving objects / adding properties
If your editor crashes when moving an object or when adding new properties, try to exit the Editor mode (click in the top left corner) and do the same steps when the game is not active in Viewport.
Let's play a sound at the same time the building is getting repaired:
-
To play a sound in the game, we need an object that can produce sounds.
-
In Outliner, right-click the scene_art section and select Create:
-
Find sound_actor_full and click it:
This object by default has the SoundEmitter property required for playing sounds.
-
-
Move the sound_actor_full object into the objective zone in the scene. This way the player will be near the source of the sound when completing the objective.
-
Next, let's create another scenario. This time, the scenario will be attached directly to the new object and not the whole scene as it was with our first scenario.
-
By default, our new object does not have a property that allows us to attach blueprint scenarios to the object. To add that property, click + to the right of the sound_actor_full name in Inspector, select prop_blueprint and click Apply:
-
Add a new blueprint: click + to the right of the Prop Blueprints property, select BlueprintClient and click Apply:
-
Click Open:
An empty window will open:
-
Add the following nodes to the scenario (the same way as for the previous scenario):
- Get First Tagged Actor
- On Enabled
- Play Sound
-
Connect the nodes and fill the Tag parameter in the Get First Tagged Actor node with build_1:
The Play Sound node requires an actor (object) that can play sounds as an input parameter. However, because our scenario is attached to an object and not a scene, the node has direct access to the sound_actor_full object (the node uses the
<OWNER>
keyword to access the object the blueprint is attached to).
-
-
Finally, select the sound that will be played.
-
Click ... next to the Sound property of the Play Sound node:
-
In the Sounds Browser, select tech_beep and click OK:
-
If everything is done correctly, the player will hear a short "beep" sound when they complete the objective and the building becomes enabled. If you want to add a custom sound, you would need to load it as an external sound or using Wwise.
See the next step.