D
D
Dmitry Korolev2017-02-10 00:33:45
C++ / C#
Dmitry Korolev, 2017-02-10 00:33:45

How to load an audio file from the global directory into the AudioClip variable?

I am making an audio player for the editor and would like to be able to play files from the global directory.
How can this be done?
AudioClip musicTrack = AssetDatabase.LoadAssetAtPath(trackNames[i], typeof(AudioClip)) as AudioClip;//probably not right?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Gleb, 2017-02-10
@adressmoeistranici

Unity will not be able to convert files outside the Assets folder to its format. Therefore, before a file can be referred to as an AudioClip, the file must be placed in a project and imported.
If you need to automatically import sound files, then this is done using the AudioImporter

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question