Audio
Inherits: Instance
Audio is a DynamicInstance that can play either sound effect or music tracks
Properties
If true, the audio will immediately begin playing when it is added to the world.
Whether the audio is currently playing. This is read-only and can only be changed by calling Play() or Stop().
If true, the audio will loop indefinitely until stopped. If false, the audio will play once and then stop.
The maximum distance at which the audio can be heard. By default, audio uses linear attenuation to determine volume over distance.
If true, the audio will call Destroy() on itself after it finishes playing. This takes priority over Loop, so if both Loop and OneShot are true, the audio will play once and then be removed.
The pitch of the audio, where 1 is normal pitch, less than 1 is lower pitch, and greater than 1 is higher pitch. Default is 1.
Play-token nonce. Play() bumps it every call so a re-Play while IsPlaying is already true still changes the value -> always dirty -> always replicates a fresh replay to every peer.
The total length of the audio, in seconds.
Current playback offset in seconds. On the authority the getter computes the live offset from the play-start reference (so the spawn/full-state snapshot a late-joiner receives is current). On a peer it returns the last replicated value. Carried in the spawn snapshot only (the authority never dirties it), so it does NOT spam per-frame delta replication.
The volume of the audio, from 0 (silent) to 1 (full volume). Default is 1.
Functions
Plays the audio from the beginning. If the audio is already playing, this does nothing.
Stops the audio if it is currently playing. If the audio is not playing, this does nothing.
Properties
Whether this Instance or any of its descendants should be included when saving or copying via Clone()
The unique identifier for this Instance.
If true, this instance and all of its descendants cannot be selected in the editor.
The name of this Instance.
The parent of this Instance in the hierarchy.
The sort index of this Instance among its siblings. If this Instance has no parent, this value is ignored.
Functions
Attaches a script to this instance by its file path. The path should be relative to the root assets directory, e.g. "Scripts/MyScript".
Creates a deep clone of this Instance and all its descendants.
Removes this Instance, and all its descendants, from the DataModel, and locks its parent property.
Schedules this Instance to be destroyed after the specified delay in seconds. This function will error if called multiple times.
Removes a script from this instance by its file path. The path should be relative to the root assets directory, e.g. "Scripts/MyScript".
Returns an array of the children of this Instance.
Gets the global bounding box that encapsulates all DynamicInstance children of this Instance.
Returns the path of the script component at , or an empty string if the script file no longer exists.
Determines if this Instance is a descendant of the specified ancestor Instance.