Blinking Text Entry Cursor

From Unify Community Wiki
Revision as of 04:18, 18 January 2012 by AkylaxlZQ (Talk | contribs)

Jump to: navigation, search

JavaScript

<javascript>//These are made private so that they don't appear in the Inspector private var m_TimeStamp = Time.time; private var cursor = false; private var cursorChar = ""; var maxStringLength : int; //Maximum characters to allow in the text entry field

function Update () {

   if (Time.time - m_TimeStamp >= 0.5) {
       m_TimeStamp = Time.time;
       if (cursor == false) {
           cursor = true;
           if (enteredString.Length < maxStringLength)
               cursorChar += "_";
       }
       else {
           cursor = false;
           if (cursorChar.Length != 0)
               cursorChar = cursorChar.Substring(0, cursorChar.Length - 1);
       }
   }

} </javascript>

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox