public string[] temp1 = new string[3]
{
	"A","B","C"
};

public string[] temp2 = new string[3]
{
	"D","E","F"
};

public string[] temp3 = new string[3]
{
	"G","H","I"
};

void GetValue()
{
	string[] tempArray = (string[])GetType().GetField("temp1").GetValue(this);

	Debug.Log("A: " + string.Join(",", tempArray));
}

 


https://stackoverflow.com/questions/11122241/accessing-a-variable-using-a-string-containing-the-variables-name

+ Recent posts