ClipAudioSource class Audio
Plays an AudioClip at a node, on any backend.
The clip comes from clip (loaded by the app) or asset (loaded by the source itself on first mount). Each play starts a fresh playback through a backend voice; pause and play resume mid-clip, stop rewinds.
This is the source the scene-description format realizes for
audioSource components, so a serialized scene's sounds play on
whichever engine the app mounts.
- Inheritance
-
- Object
- Component
- AudioSource
- ClipAudioSource
Constructors
Properties
- asset ↔ String?
-
Asset key loaded on first mount when clip is not set directly.
getter/setter pair
- attenuation ↔ AudioAttenuation
-
Spatialization parameters, re-applied every frame while playing
positionally. Sources whose attenuation is authored externally
(event middleware) treat this as an override hint at most.
getter/setter pairinherited
- autoplay ↔ bool
-
Begin playing as soon as the source is mounted and loaded.
getter/setter pair
- bus ↔ AudioBus?
-
Explicit bus to route through. Takes precedence over busName.
getter/setter pair
- busName ↔ String?
-
Name of an engine bus to route through, resolved at play time.
Useful from serialized scenes, where bus objects cannot be
referenced directly.
getter/setter pair
- clip ↔ AudioClip?
-
The clip this source plays. Assigning while playing takes effect
on the next play.
getter/setter pair
- enabled ↔ bool
-
Whether this component's update hook runs each frame.
getter/setter pairinherited
- engine → AudioEngine?
-
The nearest ancestor engine, resolved while mounted.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isAttached → bool
-
Whether this component is currently attached to a node.
no setterinherited
- isLoaded → bool
-
Whether onLoad has completed.
no setterinherited
- isMounted → bool
-
Whether the owning node is part of a live scene graph.
no setterinherited
- isPlaying → bool
-
Whether the source is currently playing (not paused or stopped).
no setteroverride
- looping ↔ bool
-
Whether playback repeats until stopped.
getter/setter pair
- node → Node
-
The node this component is attached to.
no setterinherited
- pitch ↔ double
-
Playback rate multiplier.
1.0is natural rate.getter/setter pairoverride - positional ↔ bool
-
Whether playback is spatialized at the node's world position.
When
falsethe source plays flat (music, UI). Changing it while playing takes effect on the next play.getter/setter pairinherited - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- volume ↔ double
-
Gain for this source.
1.0is unity.getter/setter pairoverride
Methods
-
cloneFor(
Node cloneOwner) → Component? -
Returns a copy of this component for
cloneOwner, the Node.clone counterpart of the owning node, or null to not carry the component to clones (the default).inherited -
fixedUpdate(
double fixedDt) → void -
Called once per fixed physics step while the component is mounted,
enabled, and loaded.
fixedDtis the fixed timestep of the surrounding PhysicsWorld, not the frame interval.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onAttach(
) → void -
Called when this component is added to a node.
inherited
-
onDetach(
) → void -
Called when this component is removed from a node.
override
-
onLoad(
) → Future< void> -
Optional asynchronous setup, such as loading an asset.
override
-
onMount(
) → void -
Called when the owning node enters a live scene graph.
override
-
onTransformSync(
Vector3 position, Vector3 velocity) → void -
Concrete-source hook receiving this frame's world position and
velocity while the source is positional and mounted under an
engine. Subclasses overriding update must call
super.updateto keep receiving it.override -
onUnmount(
) → void -
Called when the owning node leaves a live scene graph.
override
-
pause(
) → void -
Pauses playback, keeping the position; play resumes.
override
-
play(
) → void -
Begins (or restarts) playback.
override
-
stop(
) → void -
Stops playback and rewinds.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
double deltaSeconds) → void -
Called once per frame while the component is mounted, enabled, and
loaded.
deltaSecondsis the elapsed time since the previous tick.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited