I'm trying to load text from a .txt file into a TextAsset variable. The file is in the assets folder under Texts/. My problem is that bindata is returned as null.

string instructions; 

void Start ()

    TextAsset bindata = Resources.Load ("Texts/Instructions") as TextAsset;
    instructions = bindata.text;

In order to load a resource through Resources.Load, the file itself must be located in a subfolder of Asset/Resources. Try to move it there and your command will work.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.