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. Dismiss Notice

Why can not audio source run?

Discussion in 'Scripting' started by huseyinbaba58, Aug 21, 2020.

  1. huseyinbaba58

    huseyinbaba58

    Joined:
    Feb 12, 2020
    Posts:
    146
    I typed script and I assigned the script to main camera .Then I dragged audio file to script's slot.
    But When game run,audio can't run same time.
    What can I do?
     
  2. adehm

    adehm

    Joined:
    May 3, 2017
    Posts:
    369
    What script?
    How do you mean audio "can't" run as the same time?
     
  3. SkrenZz

    SkrenZz

    Joined:
    Apr 11, 2020
    Posts:
    26
    To play sound in Unity, you need an AudioSource component.
    To make things simpler and more scalable, I'd suggest making an AudioManager object with AudioManager script. Here is a nice tutorial about it which I hope will help you: