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

Audio Audio in editor mode.

Discussion in 'Audio & Video' started by Monetai, Jun 1, 2020.

  1. Monetai

    Monetai

    Joined:
    Sep 18, 2015
    Posts:
    4
    Hello !!

    I'm looking for a way to play an audio clip from a custom editor window, is it possible? Everything I found are hacks or things like that..
    If it's not possible, is it in the roadmap? Because while it's impossible to do so, it'll remain really hard to build proper alternative to middleware like FMOD or Wwise inside Unity without replacing all the audio system.. Be able to play a sound from a clip and send it to a mixer while in edit mode would allow us to improve drastically the capability of audio editors inside Unity.

    Thank you for your help!
     
  2. quizcanners

    quizcanners

    Joined:
    Feb 6, 2015
    Posts:
    108
    I used to use "UnityEditor.AudioUtil" "PlayClip" via reflection (also a hack), but it doesn't work. I'm ok with hacks, but I need a new one.
     
  3. willemsenzo

    willemsenzo

    Joined:
    Nov 15, 2012
    Posts:
    585
    You can add the ExecuteInEditMode attribute to a monobehaviour which has an audiosource and then make it play clips.
     
    awsapps likes this.
  4. RebelBinary

    RebelBinary

    Joined:
    Aug 12, 2015
    Posts:
    11
    For future reference, they renamed the methods to PlayPreviewClip and StopAllPreviewClips

    Answer here