There’s a fantastic new feature in our editor, it’s an asset of the audible nature: it’s sound and music! We’ve had the code blocks for some time, but no way to add your own sounds, but now that’s all possible. Let me talk you through it.
The first thing you need is a script to trigger the sound to play. Click on “Add new” in the scripts panel.
Next you’ll need to write your script; use the code blocks to create the image below. This script simply plays some music when the object the script is attached to is created.
Save your script, giving it a name and making sure that “The Music” variable has “Public” checked.
Now we’ve got our script, we need some music to play. Open the “Asset Manager” by clicking on “Assets” in the top right of the screen (next to preview). Create a new pack or select one you own and click the “Create New Asset” button. Select “sound/audio” and upload the music you want to use. Here’s a track to get you started;
Once your tracks are uploaded, the only thing left to do is add them to your level! Add a new game object and attach the “Play Music” script to it. Now right click the object and select “Edit Instance Properties.”
Then select the music you want to play from the drop-down;
And that’s it! You’re all set. Hit preview and enjoy the sweet serenade of you’re in-game music. Why not give some sounds a go now? It works the exact same way, the only difference is that multiple “Play Sound” blocks can be played over top of other sounds and the sounds you play wont loop like they do with music. Good luck Gamefrooters!
When I press “Edit Instance Properties” It just says that I don’t have a property.
Worked out question I asked, I think it answers yours to. There variable of the sound isn’t public. Click the button in thescript editor left of the script title. There you will see the variables in the script and can set them to public. It will work then I think
If I’ve already made the variable private, how can I make it public again to specify the sound?
Lovely just what I was looking for. Thanks to the author for taking his time on this one.
I did everything as mentioned… but the background music is isn’t playing for my game… I try it for an object its not working then i try it on the background but still remain the same no sound
Hi Vaasinathan, I think we solved your problem. Let me know if you have any further issues.
I am unable to hear the sounds I have added to my game. I have attempted it by following the steps and still no sound is audible. Please help! Thanks Gamefroot!
can anyone help me… please… !!!
Is this supposed to be a video!
it’s just not playing the sound, full stop. i triple checked that i did everything right, my only guess is that its a problem with the editor