Search Results for

    Show / Hide Table of Contents

    Class AudioManager

    This class manages the playback of sound effects in the game. It provides functionality to play specific sounds by name and ensures a singleton instance for global access.

    Inheritance
    object
    AudioManager
    Namespace: Music
    Assembly: cs.temp.dll.dll
    Syntax
    public class AudioManager : MonoBehaviour

    Fields

    Instance

    The singleton instance of the AudioManager class.

    Declaration
    public static AudioManager Instance
    Field Value
    Type Description
    AudioManager

    soundEffects

    A list of all sound effects managed by the AudioManager.

    Declaration
    public List<SoundEffect> soundEffects
    Field Value
    Type Description
    List<><SoundEffect>

    Methods

    PlaySound(string)

    Plays a sound effect by its name.

    Declaration
    public void PlaySound(string soundName)
    Parameters
    Type Name Description
    string soundName

    The name of the sound effect to play.

    Remarks

    If the sound name is "Punch," it plays multiple punch-related sound effects. If the sound is not found, a warning is logged to the console.

    In This Article
    Back to top Example Unity documentation footer