pub struct AudioCue {
pub asset_id: AssetId,
pub screen: Option<AssetId>,
pub clip: Option<AudioClipHandle>,
pub kind: CueKind,
pub volume: f32,
pub bus: Option<AudioBus>,
pub priority: i32,
}Expand description
Plays audio when a Screen is shown.
A cue links a Screen to an AudioClip: whenever UI
navigation makes the screen active (a screen:show or screen:toggle action, a
KeyBinding, dismissing an overlay back to it, or being the
world’s initial screen), the clip plays. Cues play flat on the main mix with
no 3D position; use an AudioEmitter for positional sound.
The kind decides the playback behavior:
music: loops until replaced. Showing a screen whose music cue is already playing leaves the track running, so navigating between screens that share a cue is seamless. A screen with a different music cue replaces the track; a screen with no music cue leaves the current music playing.sound: a one-shot effect, played every time the screen is shown.
Fields§
§asset_id: AssetIdAsset identity; injected via inject_name. Not part of args.
screen: Option<AssetId>The Screen whose activation triggers this cue.
clip: Option<AudioClipHandle>The AudioClip to play.
kind: CueKindPlayback behavior: a looping music track or a one-shot sound.
volume: f32Linear gain applied to the clip (1.0 leaves it unchanged).
bus: Option<AudioBus>Mix bus the cue routes through. Defaults to music for a music cue
and sfx for a sound cue; set voice for dialogue.
priority: i32Voice priority for a sound cue. When all voice slots are busy, a new
sound silences the oldest lowest-priority voice; a sound outranked by
everything playing is skipped. Higher wins; the default is 0.
Trait Implementations§
Source§impl Component for AudioCue
impl Component for AudioCue
Source§fn from_baked(bytes: &[u8]) -> Result<Self, CnResult>
fn from_baked(bytes: &[u8]) -> Result<Self, CnResult>
Source§fn inject_locator(&mut self, _locator: PayloadLocator)
fn inject_locator(&mut self, _locator: PayloadLocator)
Source§fn inject_name(&mut self, _id: AssetId)
fn inject_name(&mut self, _id: AssetId)
Source§impl ComponentSlot for AudioCue
impl ComponentSlot for AudioCue
Source§const DISCRIMINANT: u8
const DISCRIMINANT: u8
ComponentId.