- Home /
.mp3 Copy from the assets to persistentDataPath
I was on the android, you need to be copied to a .mp3 Application.persistentDataPath .mp3 assets in I tried using the following code, but fail How should I do it?
string fileName = "test.mp3";
string sourcePath = Application.persistentDataPath+"/MyMp3/";
string targetPath = Application.persistentDataPath;
string sourceFile = System.IO.Path.Combine(sourcePath, fileName);
string destFile = System.IO.Path.Combine(targetPath, fileName);
System.IO.File.Copy(sourceFile, destFile, true);
Answer by Rouge Digital · Jul 03, 2016 at 09:44 PM
I would look to see if Application.persistentDataPath ends in a "/" giving "//MyMp3/"
Looks good for the: Android is a unix system so the slashes go "/"
My path looks like "/storage/sdcard1/1/Music/Beethoven - 9th.mp3"
Also try a dir exists and file exists.
Regards, uAudio: Mp3 Player/Streamer - the mp3 player for unity
Your answer
![](https://koobas.hobune.stream/wayback/20220612043334im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Android play mp3 file 0 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Make an object move when clicking a GUI button? 1 Answer
My rigidbody2d is passing through the side of a collider2d but it's working on the top 0 Answers