The question is answered, right answer was accepted
Spawn random letters
So i'm doing a game based on random letters falling from the top of the screen and if the user press the correct letter on the keyboard, the letter disappear and add 10 to score. My problem is that i have a code which spawn a random letter from a string, but i need to do a prefab so i can spawn more than a random letter and i dont know if i need to use TextMesh or what. Here is the code in the class GameManager which return a random letter from the string:
public char EligeLetra() {
string cadena1 = "asdfghjklñmnbvcxzqwertyuiop";
return cadena1 [Random.Range (0,cadena1.Length)];
and here the code form the class LogicaLetra which call textmesh to show the letter:
public TextMesh texto;
// Use this for initialization
void Start () {
texto = GetComponent<TextMesh>();
texto.text = "" + GameManager.instance.EligeLetra();
And I want to make a method "CreaLetras" in GameManager which call a prefab to instantiate it, so a several random letters appear. But I want to invoke that method in the class LogicaLetra with:
Invoke ("CreaLetras", 1.0f);
So it calls it each 1.0 so the letters dont appear at the same time. I dont know if I explain in a right way, you can make any questions. Thank you.