I’ve made a “Resources” folder in Assets and imported there a tmp.txt withone string. Then I’ve put the next code to MainCamera:
public GameObject text1; // assigned a text in editor for this
void Start () {
Text txt1;
txt1 = text1.GetComponent();
TextAsset textDoc = Resources.Load ("/Resources/tmp.txt") as TextAsset;
if (textDoc == null) txt1.text = "null";
else txt1.text = textDoc.text;
...
}
So, I tried to put different arguments instead of “/Resources/tmp.txt”, like “tmp.txt”, “\Resources mp.txt”, “” but I always get “null”, not the string that there is in a text file.
So, actually, how can I access files with resources mechanism in Unity?