BackgroundMusic#
- NAMESPACE:
UnityUtils.ScriptUtils.Audio
An example of how to use the MusicClip. To use it, create a scriptable object (Found in the UnityUtils/Audio/Background Music path when right clicking in the “Project” tab in Unity) and add adjust its values. Then drag this scriptable object into a MusicManager.
Tip
This script is still very useful, being a music clip that will can always play.
Example Usage#
[CreateAssetMenu(fileName = "BackgroundMusic", menuName = "UnityUtils/Audio/Background Music", order = 0)]
public class BackgroundMusic : MusicClip
{
public override bool CanBePlayed()
{
// Add logic to decide if this clip can be played
return true;
}
}
Functions#
- UnityUtils.ScriptUtils.Audio.BackgroundMusic : UnityUtils.ScriptUtils.Audio.MusicClip
Public Functions
- override bool CanBePlayed ()
Will always return true, as background music should always be able to be played when picked by the MusicManager.