Search Unity

Audio Manage Audio

Discussion in 'Audio & Video' started by Nyxal_Indie, Aug 7, 2019.

  1. Nyxal_Indie

    Nyxal_Indie

    Joined:
    Jun 26, 2019
    Posts:
    179
    Hi guys, i'm programming my videogame event driven, like this article
    https://unity3d.com/how-to/architect-with-scriptable-objects
    I'm now implementing the audio system and i have some doubts. For example i have to implement:
    -sound when picking up a power up
    -sound when shooting
    -and many other base sounds
    In my case i have an event "PowerUpPicked" that is raised when a pickup collides with the player. I have the event listener attached to the Player game object that i use to call a function in my shooting script to increase for example rate fire. At the moment i use the same event listener to play the sound when a powerup is picked and it works fine but i think it's not correct way because if i attach sounds separately to every game object that i need will be a messy.
    First question: should i create just a game object that will manage all sounds for my game or a sound manager for every game object (player, enemies, etc...)?. For example -> PlayerSoundManager will manage jump sound, shooting etc...
    Second question: if i use this method i will get multiple events listeners that wait for the same event, is it a good idea?. For example: the listener attached to the sound manger used to play the sound and the listener attached to the player for increasing the fire rate.
    Any suggestion is appreciated :)