Struct Audio2dPanning | Project Tiny | 0.29.0-preview.22
docs.unity3d.com
    Show / Hide Table of Contents

    Struct Audio2dPanning

    An Audio2dPanning component controls an AudioSource's 2d panning.

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

    pan is read when the associated AudioSource starts playing. Minimal code to play an AudioClip with 2d panning:

        var eSource = mgr.CreateEntity();
        AudioSource source = new AudioSource();
        source.clip = eClip;
        mgr.AddComponentData(eSource, source);
        Audio2dPanning panning = new Audio2dPanning();
        panning.pan = 0.0f;
        mgr.AddComponentData(eSource, panning);
        mgr.AddComponent(eSource, typeof(AudioSourceStart));

    Fields

    pan

    Specifies the audio clip's playback stereo pan. Values can range from -1..1.

    Declaration
    public float pan
    Field Value
    Type Description
    Single
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023