AudioSource

Description

Sound is the key part of a game. Whether in form of sound effects or music, they are an excellent way to create atmosphere and make players immersed. We support uploading custom audio files which can be played in the game.

Properties

        string   Name 
    The custom name of this object.

        string   ClassName 
    The object-type name.

        RWObject   Parent 
    The parent of this object.

        Vector3   Position 
    Display the position of an object (global position and relative position).

        Vector3   Rotation 
    Displays the global orientation of an object.

        Vector3   Scale 
    The size of an object.

        string   AudioClip 
    Audio clips.

        bool   Mute 
    Mute the audio.

        bool   IsLoop 
    Play audio on a loop.

        bool   PlayOnAwake 
    Once checked, the audio will be played when the scene starts.

        float   Volume 
    Volume.

        float   PanStereo 
    [-1,1]-1: left 1: right.

        float   SpatialBlend 
    0: 2D sound, 1: 3D sound.

        float   ReverbZoneMix 
    Set the mixing coefficient of the sound source to reverb zone.

        int   Priority 
    Determine the priority among all sound sources in the scene. 0: highest, 256: lowest.

        float   DopplerLevel 
    This value determines how much the Doppler effect (Pitch changes along with the distance of the sound source.) will be applied to this sound source. The Doppler effect will not work if it is set to 0.

        float   Spread 
    Set the spread angle of 3D stereo or multi-channel audio in speaker space.

        Enum.AudioRolloffMode   RolloffMode 
    This value represents the speed of sound attenuation.

        float   MinDistance 
    Sound keeps constant within the minimum distance.

        float   MaxDistance 
    Maximum distance.

        ulong   DelayTime
    The delay until the audio starts to play. (unit: Hz)

Functions

    Pause()
    Pauses the currently playing audio.

    Play()
    Plays the current audio. If the audio is paused, it will continue to play.

    Stop()
    Stops the currently playing audio.

    RWObject.Create(classname)
    A special function, creating an instance of the specified class.

    DelAllChild()
    Deletes all child objects.

    Clone()
    Clones an object to create a copy.

    Destroy()
    Delete objects.

    GetAncestorByName(Name)
    Returns the object's first parent node with the same name.

    GetAncestorByClassName(className)
    Returns the object's first parent node of the same class.

    GetChildByName(Name,recursive)
    Returns the object's first child object with the same name. If the second parameter is true, it will search through descendants of all hierarchies.

    GetChildByClassName(className,recursive)
    Returns the object's first child object of the same type. If the second parameter is true, it will search through descendants of all hierarchies.

    GetAllChild()
    Seeks all its child objects and returns as a list.

    GetAllDescendant()
    Recursively seeks all its descendants and returns as a list.

    IsClass(ClassName)
    Judges whether it is the class the same as the given object class or not.

    IsAncestor(TarObj)
    Judges whether itself is the ancestor of the target object or not.

    IsDescendant(TarObj)
    Judges whether itself is the descendant of the target object or not.

    WaitForChild(childName,timeout)
    Seeks its own child object.

    Child(childName)
    Seeks its own child object by a given name.

    Equals(TarObj)
    Judges whether the target object is the same as itself or not.

Events

    SoundEnded()
    This event is triggered when the audio object is stopped or when it finishes playing.

    SoundPaused()
    This event is triggered when the playing audio object is paused.

    SoundPlayed()
    This event is triggered when the audio object is played.

    SoundResumed()
    This event is triggered when the paused audio object is played.

    SoundStopped()
    This event is triggered when the playing audio object is stopped.

    ChildAdded(childobject)
    Triggered when a child object is added.

    ChildRemoved(childobject)
    Deletes all child objects.

    DescendantAdded(descendantobject)
    Triggered when a descendant is added.

    DescendantRemoved(descendantobject)
    Triggered when a descendant is removed.

    AncestryChanged(AncestryChanged)
    Triggered when the ancestry is changed.