• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by ForeignGod · Nov 10, 2015 at 09:22 AM · stringmovecursorcharactersreplace

Moving Cursor position in a TextField/Area.

Hello, im trying to replace 1 character with 2 new ones and this results in the cursor being inbetween the 2 new characters.

 stringToEdit = stringToEdit.Replace("A","BB");


alt text

alt text

Is there a workaround or solution so i can type without placing the cursor in the front manually?

bb.png (838 B)
a.png (804 B)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
6
Wiki

Answer by YasinJavaid_ · Mar 29, 2017 at 07:20 AM

hi use this inputfeild.MoveTextEnd(false);

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image alxcancado · Aug 26, 2017 at 02:42 AM 0
Share

Simple like that!

Cheers brother!

avatar image YasinJavaid_ alxcancado · Sep 07, 2017 at 11:35 AM 0
Share

yeah thanks

avatar image
0

Answer by Eno-Khaon · Nov 10, 2015 at 11:17 AM

This might not be elegant, but it might be something to try experimenting with a little bit.

 TextEditor txt = (TextEditor)GUIUtility.GetStateObject(typeof(TextEditor), GUIUtility.keyboardControl);
 txt.cursorIndex += 1;

I can't guarantee perfection from this, but if nothing else, hopefully it's at least a good lead to start from.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ForeignGod · Nov 10, 2015 at 12:17 PM 0
Share

$$anonymous$$Ight seem stupid, but how do i implement this?

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

36 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

SOLVED - String replace % with " in C# 1 Answer

Remove empty line from string 2 Answers

count characters in string 1 Answer

How can I convert UTF8 string to arabic? 2 Answers

How to define in which text field the cursors is located 2 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges