none
how to convert file path to file itself directly? RRS feed

  • Question

  • for example:

    i got path of some.wav file, how can i convert path(string) to wave Object? thanks!

    Monday, August 17, 2015 10:22 AM

Answers

  • I am sure there will be an option to select a file using an "Open file dialog". If you want to do that in Unity5 programmatically, then there is a language C# not "Small Basic" that is what WhTurner33 meant to say. 

    In C# you can actually get the path of the file, and Open a stream to that path. 

    var fileStream = File.Open("string-path", FileMode.Open);
    This way you can create the path in to a stream of file. I do not have much experience with wave format files or the reader that you are using. But converting the path to a string path (with root folder and so on) you will be able to convert that path to a file, or file stream or what ever! Depends on your need. :-)

    The sh*t I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem

    Monday, August 17, 2015 10:42 AM

All replies

  • Do you want to do this in Small Basic?

    Jan [ WhTurner ] The Netherlands

    Monday, August 17, 2015 10:34 AM
    Answerer
  • no, Unity5
    Monday, August 17, 2015 10:37 AM
  • I am sure there will be an option to select a file using an "Open file dialog". If you want to do that in Unity5 programmatically, then there is a language C# not "Small Basic" that is what WhTurner33 meant to say. 

    In C# you can actually get the path of the file, and Open a stream to that path. 

    var fileStream = File.Open("string-path", FileMode.Open);
    This way you can create the path in to a stream of file. I do not have much experience with wave format files or the reader that you are using. But converting the path to a string path (with root folder and so on) you will be able to convert that path to a file, or file stream or what ever! Depends on your need. :-)

    The sh*t I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem

    Monday, August 17, 2015 10:42 AM