Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why am I not able to select the function from the inspector?

I’m making a Wordle game and need to add an "on end edit" function to an input field that i have in the game. However, i simply cannot add it.

public void ReadStringInput(string s, string word)
{
    input = s;

    firstLetterWord = word.Substring(0, 1);
    secondLetterWord = word.Substring(1, 1);
    thirdLetterWord = word.Substring(2, 1);
    fourthLetterWord = word.Substring(3, 1);
    fifthLetterWord = word.Substring(4, 1);

    firstLetterInput = input.Substring(0, 1);
    secondLetterInput = input.Substring(1, 1);
    thirdLetterInput = input.Substring(2, 1);
    fourthLetterInput = input.Substring(3, 1);
    fifthLetterInput = input.Substring(4, 1);

    Debug.Log(firstLetterInput + " " + firstLetterWord);

    if (firstLetterWord == firstLetterInput)
    {
        Debug.Log("first letter correct");
    }
}

There’s a different function in that script that looks about the same and i can add that one.

public void ChooseWord()
{
    Random random = new Random();

    string word =  dictionary[random.Next(dictionary.Length)];

    Debug.Log(word);
}

I tried making new functions and those i can select. I have no idea why this is happening, so i tried searching it up and couldn’t find anything like this. I’m selecting the object that has the script, and can even select functions of that script (e.g. ChooseWord), but can’t select that single one.

enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

onEndEdit function in Unity can work only with functions that have maximum of one argument. This argument will be set to the input’s value.

so just use one argument in your function that you are trying to call.

public void ReadStringInput(string value)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading