- Home /
GUI.Textfield in unity. adding a "what's on your mind" like function
hi when using GUI.textField in unity can you add a function like the text field in facebook? like a comment inside the textfield that once users click on the textfield the comment will disappear?
for example on facebook you got a textfield right? inside the textfield there is a "what is on your mind..." inside the textfield and when you click on the textfield it disappears, is there a same function like that in unity javascript? using GUI.Textfield?
also how do you block cursed words in the textfield like censoring badwords, cause i use regex.replace to allow only alphabets and spaces and using that it will not allow any signs like exclamation and question marks.... is there a same way to block specific words?
Answer by chrismcrae5712 · Nov 02, 2014 at 02:00 AM
Well I did it this way, it's a little more tidious but it works. I know this is a late post but if anyone else searches this theyll figure it out.
Assuming you string variable for your textfield is itemNameText = GUI.Textfield
Then Type this.
itemNameText = Regex.Replace(itemNameText, "fuck", "");
This way anytime you type the word "fuck" it'll replace it with an empty space. hope this helps
Your answer
![](https://koobas.hobune.stream/wayback/20220613114525im_/https://answers.unity.com/themes/thub/images/avi.jpg)