How to use music in your game

Knowledgebase / How to use music in your game

Sounds and music add depth to a game. You can add sound effects and music tracks to your games by following these steps:

1. Upload the music or sound effect

Make sure the audio file is an mp3 file, and isn’t too large. Here’s a sound effect and music track to get you started:

Download Desert-Theme-8-bit.mp3

Download explosion.mp3

Open the Asset Manager by clicking on “Assets” in the top right of the screen.


Create a new pack or select a pack you own and click the “Create New Asset” button. Select “sound/audio” and upload the music you want to use.


Screen Shot 2016-03-11 at 7.10.14 pm

2. Make a script to play the sound/music

Next, you’ll need a script to trigger the sound to play. We’ll make this script attached to a game object in your level, and the script will make the game object play the sound. Right-click on an object in your level, and select Add Script.

Screen Shot 2016-03-11 at 8.04.10 pm


You only need a couple of blocks in this script: When created (from Events), and either the “play sound effect” block or “play music” block (both are from Sounds).

Screen Shot 2016-03-11 at 7.55.10 pm

The “play sound effect” block will play audio once until it finishes. The “play music” block will play audio and loop it over and over again.

Here’s how the script should look. It simply plays some music when the object the script is attached to is created.

Screen Shot 2016-03-11 at 7.36.20 pm

Open the Script Properties (the button with three lines in the top-left corner), then give your script a name, and most importantly, make sure that the sound variable has “Public” ticked.



3. Select the music/sound effect from the object’s properties

The only thing left to do is to choose the music/sound effect on the game object’s properties. Right-click the object and select “Edit Instance Properties.”

Screen Shot 2015-10-19 at 10.27.36 am

Then select the music you want to play from the drop-down;

Screen Shot 2015-10-19 at 10.28.39 am

And that’s it! You’re all set. Hit Play and enjoy the sweet serenade of your in-game music and sounds.