Can't get passed string with InputField action methods

I am trying to implement some InputField elements in my game to allow the player to set the game configuration. The string to be entered is a decimal amount, so I convert it to a number if it passes the parsing test.

The problem is that I do not get a a valid string passed into the method. When I try to output it with Debug.Log(), even using .ToString() on the passed object, I get nothing.

Here is my method:

public void OnWhiteDenomEndEdit(string newValue)


	Debug.Log("OnWhiteDenomEndEdit(string)='" + newValue.ToString() + "'");

	whiteDenom = newValue;

	if (float.TryParse(newValue, out float number))

		whiteDenomValue = number;

}   // OnWhiteDenomEndEdit()

Here is the output from Debug.Log() on the Console:


As you can see, it outputs my message with the single quotes that should surround the contents of the passed string, but the string appears to be empty. If I break in Visual Studio at the if statement the string whiteDenom shows as being an empty string.

According to the Unity documentation and what you see in the Inspector the method is supposed to be passed a string, which I assume is supposed to be the contents of the InputField at the time, yet it appears to be empty. If it is not the contents of the field, what is supposed to be passed.

I should have mentioned that I am using 2021.3.0f1 for this, in case that matters.

Thanks for the link to your issue. In it Eno-Kohan mentions that there are two versions of the method that you can select from, but I do not see that in this version of Unity. I have a list for “On End Edit (String)” (the caps are how it shows in Unity but changing string to String made no difference.

So I have a GameObject in the Hierarchy with my script added to it. This lets me click on the plus sign to add to the list and I change the default “Runtime Only” to be “Editor and Runtime”. I then drag the GameObject with the script into the box under that.

Once I have done that the drop-down to the right of the “Editor and Runtime” setting has these options: “No Function”, “GameObject >”, “Transform >”, and “MyScriptName >”, where “MyScriptName” is the name of my script. All the items with a ‘>’ on the right side have sub-menus. I have chosen “MyScriptName” and selected the OnWhiteDenomEndEdit() method for it and it does call that method.

There is a white text entry box below that, but I don’t know if I need to enter anything in there and the Unity documentation does not give any examples for these settings that I can find.

Is there another combination of settings I should be using, maybe with a different way to declare the method to get the text string?

To better explain it :