Skip to content

Data assets

Music

The music for a level, made in the Data panel as Music: its named tracks, each with an optional intro and layers, the rules for changing from one track to another, the change used when no rule matches, and a playlist to rotate through under them. A level's Music names it, and a script asks for a track by name.

On this page

Make it

Made in Assets with Create → New data asset → Music, in the folder last clicked in the tree, or the folder of the file last clicked, which the path bar names: type its name and press Create. The .data file opens in the Inspector, which draws it in place of the selection: that is the Data panel. Double-click the file in Assets to open it again, and close it with the ✕ before its name, which goes back to the node inspector. A level’s Music, in the Levels panel, names it, with the Track it opens on; a script’s play_music asks it for a track by name, and set_music_layer turns a track’s layer up and down.

Fields

Every row the Data panel draws, with the name the .data file keeps it under. The file names its type MusicGraph.

FieldIn the fileKindDefaultWhat it does
TrackstrackslistemptyThe pieces of music this graph can name
FieldIn the fileKindDefaultWhat it does
NamenametextnoneThe name a script's play_music and a rule call this track by
ClipclipassetnoneThe clip this track plays (and loops while Looping is ticked)
IntrointroassetnoneA clip played once, straight into the track's clip with no gap. Empty for none. A track with layers takes none.
LayerslayerslistnoneClips that play in step with this one, each turned up and down by name. A track with layers starts about a tenth of a second after it is asked for.
FieldIn the fileKindDefaultWhat it does
NamenametextnoneThe name a script's set_music_layer turns this layer up and down by
ClipclipassetnoneThe clip this layer plays, in step with the track's. It must be as long as the track's clip, or it drifts out of step.
Volumevolumenumber, 0 to 1, step 0.01noneHow loud the layer starts: 0 is silent, 1 is as loud as the track
LoopingloopingcheckboxnoneLoop the clip until another track takes its place. Off, the track plays once and stops, and an At End from it starts the next track where it ends.
RulesruleslistemptyHow to get from one track to another
FieldIn the fileKindDefaultWhat it does
FromfromtextnoneTrack being left. Empty means any.
TototextnoneTrack being asked for
Howhowone of Immediate, CrossFade, AtEndnoneHow the change happens: a cut, a crossfade, or at the end of its pass. A cut or a crossfade into a track with layers is heard about a tenth of a second after it is asked for.

Shown when How is CrossFade

FieldIn the fileKindDefaultWhat it does
Secondssecondsnumber, 0 to 30, step 0.1noneHow long the two tracks overlap, one fading out as the other fades in
Default Transitiondefaultone of Immediate, CrossFade, AtEndCrossFadeUsed when no rule matches

Shown when Default Transition is CrossFade

FieldIn the fileKindDefaultWhat it does
Secondssecondsnumber, 0 to 30, step 0.11 sHow long the two tracks overlap, one fading out as the other fades in
Playlistplaylistsection—Clips to rotate through, for ambience that must not repeat
FieldIn the fileKindDefaultWhat it does
ClipsclipslistemptyClips this playlist rotates through
ShuffleshufflecheckboxoffPlay in a random order, reshuffled each time through
Seedseednumber0Shuffle seed. The same seed is the same order.
Positionatnumber, at least 00How far through the pass it is