Struct AudioSource | Project Tiny | 0.32.0-preview.54
docs.unity.cn
    Show / Hide Table of Contents

    Struct AudioSource

    An AudioSource component plays back one audio clip at a time.

    Namespace: Unity.Tiny.Audio
    Syntax
    public struct AudioSource : IComponentData
    Remarks

    Multiple audio sources can play at the same time. To start playback use the AudioSourceStart component. To stop playback use the AudioSourceStop component.

    clip, volume, and loop are read when the audio source starts as a result of AudioSourceStart being added. clip and loop will not change audio that is already playing.

    isPlaying is updated with every tick of the world.

    Fields

    clip

    Specifies the audio clip that plays when this source starts playing.

    Declaration
    public Entity clip
    Field Value
    Type Description
    Entity

    loop

    If true, replays the audio clip when it reaches end.

    Declaration
    public bool loop
    Field Value
    Type Description
    Boolean

    volume

    Specifies the audio clip's playback volume. Values can range from 0..1.

    Declaration
    public float volume
    Field Value
    Type Description
    Single

    Properties

    isPlaying

    True if the audio clip is currently playing.

    Declaration
    public bool isPlaying { get; set; }
    Property Value
    Type Description
    Boolean
    Remarks

    isPlaying will start false, and will be false until the AudioSourceStart tag is removed by the Audio system.

    Back to top Copyright © 2020 Unity Technologies
    Generated by DocFX
    on Saturday, January 23, 2021