MusicComponentclass
Plays background music through `Sandbox.Game.Music`. Drop it in, pick a track. Only one track plays at a time, so enabling another music component crossfades to it. Music isn't tied to the scene - to keep a track going across scene loads either put this on a DontDestroyOnLoad object or turn off StopOnDisable.
Constructors1
Showing 1 constructors
public MusicComponent()
No results match this filter.
Methods2
Showing 2 methods
public void Play()
Play this track, crossfading from whatever is playing.
void—public void Stop()
Fade out and stop, if this track is the one playing.
void—No results match this filter.
Properties7
Showing 7 properties
public float Sandbox.MusicComponent.FadeIn { get; set; }
Seconds to fade in when starting, and to crossfade from whatever was playing.
float—public float Sandbox.MusicComponent.FadeOut { get; set; }
Seconds to fade out when stopping.
float—public bool Sandbox.MusicComponent.Loop { get; set; }
Start again when the track ends.
bool—public bool Sandbox.MusicComponent.PlayOnStart { get; set; }
Start playing as soon as this component is enabled.
bool—public bool Sandbox.MusicComponent.StopOnDisable { get; set; }
Stop the music when this component is disabled or destroyed, if it's still the track playing. Turn off to let it carry on, e.g. across a scene load.
bool—public Sandbox.SoundFile Sandbox.MusicComponent.Track { get; set; }
The music to play. Tick Loop in the sound editor for a gapless loop.
public float Sandbox.MusicComponent.Volume { get; set; }
Volume of this track, on top of the game's music volume.
float—No results match this filter.