Input fields not updating counter text? (My easy Fix)

+2 votes
asked Feb 23, 2016 in Issue by mhurtado (140 points)

Hey!

I recently bought Material UI. I was already a fan of the asset before it goes to the store and I must say I like the product.

Well, I have noticed that the input fields do not update the counter text when you type on it during "Play Mode".

So I added this line in the Update Function (line 876. MaterialInputField.cs) :

                UpdateCounter();

The code should look like this:

void Update()
        {
            if (Application.isPlaying)
            {
                if (inputField.isFocused)
                {
                    SetLayoutDirty();
                    m_LastFocussedState = true;
                }
                else
                {
                    if (m_LastFocussedState)
                    {
                        m_LastFocussedState = false;
                        OnDeselect(new PointerEventData(EventSystem.current));
                    }
                }

                UpdateSelectionState();
                //I just added this to make it work
                UpdateCounter();

                CheckHintText();
                CheckInteractable();

                if (m_AnimateHintText)
                {
                    SetHintLayoutToFloatingValue();
                }
            }
        }

If anyone had this problem, I hope this helps.

Cheers.

Mike

1 Answer

0 votes
answered Mar 7, 2016 by admin (31,720 points)
Hey there,

What Unity/MaterialUI versions are you using? Does this happen in a blank project?

~ Declan
Welcome to MaterialUI support! Ask us anything :)
...