- Home /
How to load directory of files into a script and read them as TextAsset objects?
I have a script attached to an object in Unity. I want to load a folder of .vtk files into my project assets folder, attach that folder to the script on the object as I would attach any public variable to a script in the editor (by dragging and dropping it), and have my script read each .vtk file in the folder as separate TextAsset objects. I would actually like each file to be an element of a TextAsset array, but that should be easy once I can get Unity to accept the folder of .vtk files as individual TextAsset objects.
I've tried declaring a public Directory and Path object to specify the folder, but I get the error that I "cannot declare a variable of static type 'Directory'".
Your answer
![](https://koobas.hobune.stream/wayback/20220612171107im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Script is only working on original object 2 Answers
nut and bolt object construction system? 0 Answers
Floating point origin script help 0 Answers
Can't Create Directory 1 Answer