What I’m trying to do is this,
using UnityEngine;
using System.Collections;
public class CheckBool : MonoBehaviour {
public string scriptName;
public string varName;
public bool Check () {
Component other;
other = gameObject.GetComponent(scriptName) as Component;
//This is the issue here. I want to get the variable on other using the name
//stored in the varName variable.
if (other.varName == true) {
Debug.Log ("Welp, it was true");
return true;
}
Debug.Log ("Sorry, it was false");
return false;
}
}
I want to access varName on other. But varName is a variable on the script. How would I do this?
Thanks.