- Home /
Unity gives me error for gamedata.value
I am making login system and i need to use gamedata.value but unity doesn't recognize it.
and "gamedata" is what exactly? you need to provide a bit more information and, call me crazy, maybe some code to provide a little context...
sorry i meant logindata, here is the code
public class Button$$anonymous$$anager : $$anonymous$$onoBehaviour {
private $$anonymous$$asterClient $$anonymous$$Client;
void Start()
{
$$anonymous$$Client = GameObject.Find("$$anonymous$$asterClient").GetComponent<$$anonymous$$asterClient>();
}
public void SendLogin()
{
InputField[] loginData = GameObject.Find("LoginPanel").GetComponentsInChildren<InputField>();
string username = loginData[0].value;
string password = loginData[1].value;
$$anonymous$$Client.SendPacket(0,username+ "~"+ password);
}
}
InputField is the InputField in Unity where players type username and password.I get UnityEngine.UI.InputField does not contain a definition for value and no extension method value of type UnityEngine.UI.InputField could be found(are you missing a using directive or an assembly reference?).
(foolishly) assu$$anonymous$$g that you have an InputField
with the Text element called "InputFieldText", then the following should work.
var inputField = GameObject.Find("InputFieldText");
if (inputField != null)
{
var inputText = inputField.GetComponent<Text>();
if (inputText != null)
{
if (!string.IsNullOrEmpty(inputText.text))
{
Debug.Log(inputText.text);
}
}
}
Your answer

Follow this Question
Related Questions
A node in a childnode? 1 Answer
Custom mouse cursor is laggy on low/mid hardware 0 Answers
textures vs textureless 2 Answers
Gui button for attachment 1 Answer
Prevent the Player from moving inside the wall "Blending" 0 Answers