Load external file as TextAsset

I have looked around on the matter and all solutions I found uses Resources.Load. Basicly I have some text files on a external folder inside StreamingAssets which when you build the game that folder won’t be included in the build itself but will go inside the game Data folder.

My problem is to load those external files as TextAsset in a array, is not a problem to retrieve the path and everything, the problem is only to convert the string path into a TextAsset.

So all I need is to be able to load an external file using a path and return a TextAsset without using Resources.

A TextAsset is, like the name suggests, an asset. All assets are compiled into the project itself. Everything that’s not included is not an asset in the sense of Unity. The only exceptions are AssetBundles for which you need Unity pro. You can load external files like @GameVortex said or by using the System.IO namespace but only to use the content. You can’t “create” TextAssets at runtime.

Why do you want the files as TextAssets? It would be much easier to help you when you explain why you need them as TextAssets.

You probably want the WWW class which can load a file from disk using the file:// protocol. Read more about it in the reference here.

Example:

Enumerator Load() 
{
    WWW www = new WWW("file://" + path);
    yield return www;
    String text = www.text;
}

www does not return a TextAsset but you can get bytes or string from it which is the same as you can get from the TextAsset.