Load a folder of files defined by the user at runtime? Custom radio
up vote
1
down vote
favorite
I am trying to create custom radio tracks in my Unity game, and I want the user to be able to place audio files in a directory like My Documents/My Games/Unity Game/Custom Sounds/ . Then I want Unity to put all audio clips from this folder into an array for me to use in my code. I have searched but cannot find anything about loading a file you don't know the exact path of, or how many there will be
unity3d filesystems assets audioclip
add a comment |
up vote
1
down vote
favorite
I am trying to create custom radio tracks in my Unity game, and I want the user to be able to place audio files in a directory like My Documents/My Games/Unity Game/Custom Sounds/ . Then I want Unity to put all audio clips from this folder into an array for me to use in my code. I have searched but cannot find anything about loading a file you don't know the exact path of, or how many there will be
unity3d filesystems assets audioclip
2
This is actually a pretty big question, there are several file browsers you can download from the Unity Asset store, or you can build your own. if you are building your own you can start by using the path provided by the Application.PersistentData Path, and using the classes in System.IO for navigation, and getting a list of files in a directory.
– Eddge
Nov 20 at 1:50
@Eddge I've got that working, any idea how to turn all found files into audio clips? I'm close but there is no audio, the length of the clip is correct though
– Toxxic
Nov 20 at 20:21
Yes, use the WWW class. docs.unity3d.com/ScriptReference/WWW-audioClip.html for the URL usefile://
then the path of the file, it is important to note that unity only supports some music file formats, depending on the platform. So for example .mp3 will not work if building for windows desktop.
– Eddge
Nov 21 at 14:41
@Eddge that did it, thanks!
– Toxxic
Nov 22 at 4:16
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I am trying to create custom radio tracks in my Unity game, and I want the user to be able to place audio files in a directory like My Documents/My Games/Unity Game/Custom Sounds/ . Then I want Unity to put all audio clips from this folder into an array for me to use in my code. I have searched but cannot find anything about loading a file you don't know the exact path of, or how many there will be
unity3d filesystems assets audioclip
I am trying to create custom radio tracks in my Unity game, and I want the user to be able to place audio files in a directory like My Documents/My Games/Unity Game/Custom Sounds/ . Then I want Unity to put all audio clips from this folder into an array for me to use in my code. I have searched but cannot find anything about loading a file you don't know the exact path of, or how many there will be
unity3d filesystems assets audioclip
unity3d filesystems assets audioclip
asked Nov 20 at 0:52
Toxxic
2215
2215
2
This is actually a pretty big question, there are several file browsers you can download from the Unity Asset store, or you can build your own. if you are building your own you can start by using the path provided by the Application.PersistentData Path, and using the classes in System.IO for navigation, and getting a list of files in a directory.
– Eddge
Nov 20 at 1:50
@Eddge I've got that working, any idea how to turn all found files into audio clips? I'm close but there is no audio, the length of the clip is correct though
– Toxxic
Nov 20 at 20:21
Yes, use the WWW class. docs.unity3d.com/ScriptReference/WWW-audioClip.html for the URL usefile://
then the path of the file, it is important to note that unity only supports some music file formats, depending on the platform. So for example .mp3 will not work if building for windows desktop.
– Eddge
Nov 21 at 14:41
@Eddge that did it, thanks!
– Toxxic
Nov 22 at 4:16
add a comment |
2
This is actually a pretty big question, there are several file browsers you can download from the Unity Asset store, or you can build your own. if you are building your own you can start by using the path provided by the Application.PersistentData Path, and using the classes in System.IO for navigation, and getting a list of files in a directory.
– Eddge
Nov 20 at 1:50
@Eddge I've got that working, any idea how to turn all found files into audio clips? I'm close but there is no audio, the length of the clip is correct though
– Toxxic
Nov 20 at 20:21
Yes, use the WWW class. docs.unity3d.com/ScriptReference/WWW-audioClip.html for the URL usefile://
then the path of the file, it is important to note that unity only supports some music file formats, depending on the platform. So for example .mp3 will not work if building for windows desktop.
– Eddge
Nov 21 at 14:41
@Eddge that did it, thanks!
– Toxxic
Nov 22 at 4:16
2
2
This is actually a pretty big question, there are several file browsers you can download from the Unity Asset store, or you can build your own. if you are building your own you can start by using the path provided by the Application.PersistentData Path, and using the classes in System.IO for navigation, and getting a list of files in a directory.
– Eddge
Nov 20 at 1:50
This is actually a pretty big question, there are several file browsers you can download from the Unity Asset store, or you can build your own. if you are building your own you can start by using the path provided by the Application.PersistentData Path, and using the classes in System.IO for navigation, and getting a list of files in a directory.
– Eddge
Nov 20 at 1:50
@Eddge I've got that working, any idea how to turn all found files into audio clips? I'm close but there is no audio, the length of the clip is correct though
– Toxxic
Nov 20 at 20:21
@Eddge I've got that working, any idea how to turn all found files into audio clips? I'm close but there is no audio, the length of the clip is correct though
– Toxxic
Nov 20 at 20:21
Yes, use the WWW class. docs.unity3d.com/ScriptReference/WWW-audioClip.html for the URL use
file://
then the path of the file, it is important to note that unity only supports some music file formats, depending on the platform. So for example .mp3 will not work if building for windows desktop.– Eddge
Nov 21 at 14:41
Yes, use the WWW class. docs.unity3d.com/ScriptReference/WWW-audioClip.html for the URL use
file://
then the path of the file, it is important to note that unity only supports some music file formats, depending on the platform. So for example .mp3 will not work if building for windows desktop.– Eddge
Nov 21 at 14:41
@Eddge that did it, thanks!
– Toxxic
Nov 22 at 4:16
@Eddge that did it, thanks!
– Toxxic
Nov 22 at 4:16
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
From @Eddge:
Yes, use the WWW class. docs.unity3d.com/ScriptReference/WWW-audioClip.html for the URL use file:// then the path of the file, it is important to note that unity only supports some music file formats, depending on the platform. So for example .mp3 will not work if building for windows desktop
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
From @Eddge:
Yes, use the WWW class. docs.unity3d.com/ScriptReference/WWW-audioClip.html for the URL use file:// then the path of the file, it is important to note that unity only supports some music file formats, depending on the platform. So for example .mp3 will not work if building for windows desktop
add a comment |
up vote
0
down vote
accepted
From @Eddge:
Yes, use the WWW class. docs.unity3d.com/ScriptReference/WWW-audioClip.html for the URL use file:// then the path of the file, it is important to note that unity only supports some music file formats, depending on the platform. So for example .mp3 will not work if building for windows desktop
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
From @Eddge:
Yes, use the WWW class. docs.unity3d.com/ScriptReference/WWW-audioClip.html for the URL use file:// then the path of the file, it is important to note that unity only supports some music file formats, depending on the platform. So for example .mp3 will not work if building for windows desktop
From @Eddge:
Yes, use the WWW class. docs.unity3d.com/ScriptReference/WWW-audioClip.html for the URL use file:// then the path of the file, it is important to note that unity only supports some music file formats, depending on the platform. So for example .mp3 will not work if building for windows desktop
answered Nov 22 at 4:16
Toxxic
2215
2215
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53384715%2fload-a-folder-of-files-defined-by-the-user-at-runtime-custom-radio%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
This is actually a pretty big question, there are several file browsers you can download from the Unity Asset store, or you can build your own. if you are building your own you can start by using the path provided by the Application.PersistentData Path, and using the classes in System.IO for navigation, and getting a list of files in a directory.
– Eddge
Nov 20 at 1:50
@Eddge I've got that working, any idea how to turn all found files into audio clips? I'm close but there is no audio, the length of the clip is correct though
– Toxxic
Nov 20 at 20:21
Yes, use the WWW class. docs.unity3d.com/ScriptReference/WWW-audioClip.html for the URL use
file://
then the path of the file, it is important to note that unity only supports some music file formats, depending on the platform. So for example .mp3 will not work if building for windows desktop.– Eddge
Nov 21 at 14:41
@Eddge that did it, thanks!
– Toxxic
Nov 22 at 4:16