Audio System
A system that manages your sounds based on Unity's audio system.
Last updated
Was this helpful?
A system that manages your sounds based on Unity's audio system.
Last updated
Was this helpful?
The audio system in the FPS Framework is built around audio profiles. These profiles are scriptable objects that carry all the essential data for a specific sound. They allow managing of how the sounds behave, giving you precise control over their functionality.
To create an audio profile, follow these steps:
Right-click anywhere in your project.
Navigate to the Create menu.
Select Akila > FPS Framework > Audio Profile.
This will generate a new audio profile for you to configure. This is the menu to access:
This is what you should see when your audio profile is created:
To use that audio profile you need a small code. Start by creating a new script and call it, AudioPlayerTest.
In the AudioPlayerTest, make sure to add the using text for FPS Framework like this:
Now add a refrence to that audio profile and an Audio object, like this:
The _audio class is the brain of your sound, it controls everything about it and makes every sound independent with its own audio source.
Before playing your sounds, you need to initialize them in the start method. This is how to initialize and audio object:
Now you can freely play your sound by calling Audio.Play() or Audio.PlayOneShot() like this:
The audio system in the FPS Framework includes built-in tools to simulate sound variations by randomizing pitch, adding a layer of realism to your audio. Additionally, it provides custom events that can be triggered at specific points within a sound—whether at the midpoint, 30% in, or any other position—offering you complete control over when events are executed.
The fields at the beginning of the audio profile function identically to those of an AudioSource. For more detailed information, refer to Unity's official documentation on AudioSource.
To randomize the pitch, simply enable the "Dynamic Pitch" option in the audio profile settings.
You can add events in unity editor to the "Custom Events" list or in code. If you set your custom event's "Location" to 0.1, the event will be invoked when the audio played 10% of its lenght, if you set it to 0.54 the event will be invoked at 54% of its lenght and so on.