Search Unity

InputField Bug?

Discussion in 'UGUI & TextMesh Pro' started by Zathos91, Nov 23, 2014.

  1. Zathos91


    Aug 26, 2014
    Hi guys i created a chat system for my game. The logic is that when a player push the Return Button, an InputField appears and he can start writing on that, and after the second pushing of the return button the text will be displayed on everyone that is connected.

    When the player clicks the return button, the Input field is correctly focused, but it looks like there is a new line that is putted and you are not able to see what you are typing (caused by the new line).

    Since maybe i've not explained myself well i'll post the code and the screenshots that will show you the problem..

    How can i remove this "newline" thing that appears?
    Is it my problem or something else?

    Code (CSharp):
    1. if (photonView.isMine)
    2.         {
    3.             if (Input.GetKeyDown(KeyCode.Return)){
    4.                 if(go_chatInput.gameObject.activeSelf == true){
    5.                     Debug.Log("Sending");
    6.                     photonView.RPC("SendMessage",PhotonTargets.All,,chat_Input.text);
    7.                     //chat_Input.text = string.Empty;
    8.                     go_chatInput.SetActive (false);
    9.                     GetComponent<PlayerMove>().enabled = true;
    10.                     GetComponent<PlayerShooting>().enabled = true;
    11.                 }
    12.                 else{
    13.                     go_chatInput.gameObject.SetActive(true);
    14.                     GetComponent<PlayerMove>().enabled = false;
    15.                     GetComponent<PlayerShooting>().enabled = false;
    16.                     EventSystem.current.SetSelectedGameObject(go_chatInput, null);
    17.                     go_chatInput.GetComponent<InputField>().OnPointerClick(new PointerEventData(EventSystem.current));
    18.                 }
    20.             }

    Hierarchy Example:
    This is what appears when i write in-game without seeing what i'm typing

    Game Example
    and that's what appears after the second pressing...