Questions about file Browser and user assigning file to an object
Hi, I'm building a virtual midi controller with unity. I'm looking into a way for user to change the sound of each individual key either by choosing the sound library int he unity folder or any sound files from their directory.
Is this possible?
I've been looking for tutorials on file browsers and such customiseability, but could not find any. And I'm not really experienced in coding or C# in this matter to come up with my own code :(.
Can anyone help point me to the right direction? What kind of functions I'm looking for, where should I look, what do I need to read?
Out of the box, @Eric5h5 had a nice little browser asset for ~$10 you can pick up that takes are of the need to do it yourself, though mobile would be a concern given restrictions on some of the platforms. Take a look, https://starscenesoftware.com/unifilebrowser.html
There are some free ones on the assets store as well, this could be a good starting point if you want to customize from that standpoint: https://www.assetstore.unity3d.com/en/#!/content/18308
thank you, I'll look into that. but buying is my last resort right now.
Answer by toddisarockstar · Sep 15, 2016 at 09:10 PM
landern made a good comment about finding a plug in that might make things easier for you. But Unity does do about everything you want with reading and writing files if you want to code it yourself.
import System;
import System.IO;
import System.Diagnostics;
var bt:byte[];
var dir="C:/WhateverFolderOnTheUsersCdrive";
var info2 = new DirectoryInfo(dir);
var files2=info2.GetFiles();
for(file567 in files2){
print("i see: "+file567.FullName);
if(file567.Name.Contains(".mp3"){
print("i found an mp3 file");
bt=File.ReadAllBytes(file567.FullName);
}}
this sort of thing only works on standalone builds
Thank you, I'll try this code. I am currently learning unity and doing a project for school work. That's why plug ins is my last resort.