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

Why can't I drag audio onto a game object?

Discussion in 'Editor & General Support' started by TharosTheDragon, Sep 6, 2017.

  1. TharosTheDragon

    TharosTheDragon

    Joined:
    Sep 2, 2017
    Posts:
    13
    As mentioned in the Space Shooter thread, dragging an audio file from the assets folder onto a game object (e.g. in the inspector) doesn't seem to work in newer versions of Unity. Instead of making an audio source component on that game object, it creates an audio source component on a new game object. Surely this is not good behavior. Can it be fixed?

    EDIT: I've just discovered that it works correctly when audio is dragged onto a game object in the hierarchy window. There needs to be a way to do this for prefabs in the assets folder, though.
     
    Last edited: Sep 6, 2017
    dan_ginovker likes this.
  2. mpmlopes

    mpmlopes

    Joined:
    Jan 5, 2018
    Posts:
    5
    Following the Space Shooter tutorial as well, and having the same issue.
     
  3. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,727
    This is definitely a bug:
    https://issuetracker.unity3d.com/is...1.2083701554.1515624910-1429681818.1514937348

    You can manually add an Audio Source component by clicking the "Add Component" button on the gameobject, and choosing Audio Source. Then drag the audio clip into the inspector on the "AudioClip" field.

    It used to be if you dragged an audio clip onto gameobject with existing audio source component, the audio clip reference on the Audio Source was replaced with new clip, rather than creating a brand-new audio source component.
     
  4. Kentombaidoo

    Kentombaidoo

    Joined:
    Oct 19, 2022
    Posts:
    2
    I have tried it but it still does not work
     
    dan_ginovker likes this.
  5. nabilsoumanou7

    nabilsoumanou7

    Joined:
    Dec 29, 2022
    Posts:
    1
    Hello, Hope you're doing well
    I got the same problem
    I fix it finally
    I have used an audio file with .m4a extension, after convert the file to an .mp3 file , it works for me.
    Hope, this help you.
    Have a good day