How can I pass values from one MonoBehaviour class to another MonoBehaviour class using the current instance of the class (GameController in this example) without using static methods/variables? Thank you very much!
public class GameController : MonoBehaviour
{
public string midFilePath;
void FromMenu (string path)
{
midFilePath = path;
}
}
public class Menu : MonoBehaviour
{
string path = "";
void OnGUI()
{
path = GUI.TextField(new Rect(80, 20, 600, 30), path, 255);
if (GUI.Button (new Rect (20, 20, 50, 30), "Load"))
//How to make GameController.midFilePath = Menu.path?
}
}