Unity integration
A step by step guide to integrate the Runtime Sounds SDK into your Unity project
Last updated
A step by step guide to integrate the Runtime Sounds SDK into your Unity project
Last updated
You can visit our Unity SDK GitHub releases page to access the latest release and install it via the Unity package manager. Within the Unity Package Manager you will see an 'Install from Git url' option when you click on the + icon in the top left. This is the option that you should select, and you should use the url specified on the SDK release that you would like to install from the link above.
Once the SDK is installed in your Unity project, you should then go to Tools -> Runtime Sounds -> Account in the Unity top bar. Once you do this you should then see the account settings window as shown below. When you see this window you should click the 'Get API Key' button to setup your API Key.
Alternatively, you also can go straight here to generate your API Key instead.
Once you have gone clicked 'Get API Key', you will be asked to sign in. You can do so with either Google Login if you have a gmail account, or with a magic link that will be sent to your email.
Once you have successfully signed in you should land on the API Keys page. Once on this page, click 'Create'. You can then give your API key a name before clicking create again, at which point you should see the modal below with your new API key.
Once you have your API key, you then need to copy it, come back to Unity, and paste it in the API Key section in the account window from before, as shown below. You will know if everything has worked if you see a green 'API Key is valid' message.
Now that the plugin is setup, you can add a Runtime Sounds sound to your scene by creating a new empty GameObject, and then adding a Runtime Audio component to it as shown below.
Once you have a GameObject in your scene with this component added, you then need to set a target audio source component, and choose a sound. For the sake of this example, let's add an audio source component to the same GameObject, assign it to the Audio Source property on the Runtime Audio component, and then click 'Set' to choose a sound. Once you've done that you should see something similar to the below:
At this point, you can select any sound from the list by clicking 'Select', and when you do that sound will be assigned in your Runtime Audio component. Choose any sound you want to try, and then click 'Select'. Once you've done this, then make sure to toggle on 'Play on Load' in the Runtime Audio component, and then click the Play button to start the scene. You should now hear your sound.
Can't find any sounds in the our supported audio libraries to fit your needs? No problem, you can also generate your own sounds by going to Tools -> Runtime Sounds -> Generate Sound in the top bar. Once you do this, you will see the following window, and if you fill in the name, description, and duration fields you can automatically generate a new sound from scratch by clicking 'Generate New Sound', as shown below.
Once you've successfully generated your new sound, it wil be available to assign to a component in the Audio Search window from step 3 by changing the source dropdown to 'My Sounds'.
Sound generation is quite expensive for us, so we only provide 5 sound generations for free, purely because we don't have the funds to make it free for everyone. As new cheaper AI models get released we will try to increase the free quota as much as possible. When you've used up your 5 generations you will see a 'Quota Exceeded' button that will direct you to our website should you wish to pay to be able generate more.
A huge benefit of using Runtime Sounds is that you don't have to store any sound files in you game build meaning that you can keep your game build very small. However, there might be times where you actually want to include the sounds in your game build and not rely on the availability of the Runtime Sounds API. For this use-case you can cache any Runtime Sound locally by clicking the 'cache' button in the Runtime Audio component. This will then cache your sound locally in your project so no API request will need to be made to fetch your sound when it plays. You can confirm whether a sound is cached or not by the amber (cached) tag, as shown below.
That's pretty much it!
You can now browse sounds, generate sounds, cache sounds, and do whatever you want from here on out. We're always looking for new ideas to add to the plugin, so if you have an idea, or a free sound library that you think it would be good to include in the plugin, then please reach out and let us know.
If you have any questions or need any support, then you can contact us at runtimesounds@gmail.com.