Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Play audio files from project

Discussion in 'Audio & Video' started by mikhach, Feb 7, 2015.

  1. mikhach

    mikhach

    Joined:
    Dec 8, 2014
    Posts:
    5
    Hi. Please tell me a script that would play all files from a folder in a row such that the audio will be in the project.
     

    Attached Files:

    • 1.JPG
      1.JPG
      File size:
      17.6 KB
      Views:
      801
  2. Veemix

    Veemix

    Joined:
    Dec 5, 2014
    Posts:
    25
    Hey mikhach, it looks like you would need to create a game object with an Audio Source attached to it, then load the raw audio files seen in your screenshot into the Audio Source as Audio Clips. From there, you would need to attach a new script to the same game object and somewhere within that script (say in the Update() method) you would call audio.Play(); to play the loaded Audio Clip.
     
  3. mikhach

    mikhach

    Joined:
    Dec 8, 2014
    Posts:
    5
    Thank you, it's understandable, but how to automatically cause the load audio files in Audio Source as Audio Clip to a file in the Audio Clip picked up by resources from which the screenshot.