Suppose I have a talking robot in my game. In the MonoBehavior class, he has the method public void Talk(string s).
Inside my game, I want to have a text field where the user could write the body of a C# function, like that:
public string MakePhraseFromWords(string[] words){
//user can write code here
string s = "";
for(int i = 0; i < words.Length; i++)
s += words[i];
if(i < words.Length - 1) s += " ";
}
return s;
}
Given the user write this code, I would like to return s to the MonoBehaviour class method Talk so the robot could say the phrase s.
How can I do that?