- Home /
How to update a EditorGUILayout Textfield value in realtime?
Hi I am currently creating a custom editor window where there exist a Textfield where the user input a string which will be used as a alphabetical or alphanumerical token.
I would like to be able to handle what the user types in and display everything in upper case. I would also want the system to only display the first six characters.
validationToken = EditorGUILayout.TextField("Project Token", validationToken); validationToken = validationToken.ToUpper(); if(validationToken.Length>6) validationToken = validationToken.Substring(0, 6);
So I have the following code inside of OnGui()
if we input the following string: "asdfghjk" in the text field it will be displayed "asdfghjk" but the desired output would be something as follow
"a"
"As"
"ASd"
"ASDf"
"ASDFg"
"ASDFGh"
"ASDFGH"
and no matter what else I type, only the first 6 characters of the string will be displayed.
So far the textfield only updates when I click out of it or press enter, in other words when it loses focus. I tried to repaint() but it did not work. If anyone can shed some light to this issue I will apreaciate it a lot.
Your answer
Follow this Question
Related Questions
Unity editor extension - create drag and drop (similar to Buildbox) 1 Answer
Custom editor window stopped showing up 1 Answer
why I Cant Add Multiple Objects to the "Object Field" in Editor Window? 3 Answers
Fix editor TextField cursor alignment 1 Answer
Custom Editor - Is there any way to detect whether the user is in Prefab editing mode? 1 Answer