Here is my code I’m doing a test with :
var numbercurrentobj;
var newnumber1;
function Start () {
numbercurrentobj = "456245";
}
function Update () {
var readerObjcurrentobj = File.OpenRead(Application.dataPath+"/Resources/currentobj/" +"currentobj.txt");
reader = new StreamReader(readerObjcurrentobj);
var infocurrentobj : String = reader.ReadToEnd();
levelInfocurrentobj = infocurrentobj.Split("
"[0]);
newnumber1 = levelInfocurrentobj[0];
reader.Close();
if (newnumber1 == "1"){
{
Debug.Log ("number is 1", gameObject);
}
}
}
My question is this - is there a way to have the string (numbercurrentobj) be part of the data path?
In pseudo code, I was hoping for something like this :
var readerObjcurrentobj = File.OpenRead(Application.dataPath+"/Resources/currentobj/"numbercurrentobj +"currentobj.txt")
It should work so that it opens Resources>currentobj>(folder with same name as string)>text file.
Is there a way to do this? Specifically, what would I need to type instead of that one line of pseudo code?