Search Unity

Position Carrot in InputField

Discussion in 'Immediate Mode GUI (IMGUI)' started by Epictickle, Nov 24, 2014.

  1. Epictickle

    Epictickle

    Joined:
    Aug 12, 2012
    Posts:
    431
    Okay, so I'm trying to make an InputField for my ChatWindow automatically type the required text for sending a whisper. The format for sending a whisper is this:
    "/w [PlayerName] [Message]"

    Now, whenever someone receives a whisper, a string is stored in their script with the name of the player that whispered them. When the user presses the "r" button, it automatically pulls up the chat window and types "/w [LastWhisperName]" into the chatwindow. This all works perfectly except for the fact that:

    1. It doesn't automatically select the InputField every time the chatwindow is opened, and
    2. If it does actually select the inputField, then all of the text I had pre-written for the player is automatically highlighted and if they begin typing it just deletes it all.. Obviously I don't want this.. Is there any way to un-highlight the text programatically, or make it where it doesn't highlight the text when the Inputfield is selected?