Author Topic: Modify caret size  (Read 1547 times)


  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 27
    • View Profile
Modify caret size
« on: February 08, 2014, 08:51:26 PM »
I'm already pleased with the improvements made to the UIInput class yet I could see one simple addition:
Being able to choose the size of the caret.

Right now, I see that you're using a quick geometry made of verts to render caret and highlights:
  1. caret.Add(new Vector3(x - 1f, -y - fs));
  2. caret.Add(new Vector3(x - 1f, -y));
  3. caret.Add(new Vector3(x + 1f, -y));
  4. caret.Add(new Vector3(x + 1f, -y - fs));

I saw these lines multiple times in the NGUIText class PrintCaretAndSelection method.

I'd like to tweek that a little bit so that I could render a "squarer" or larger caret than the pipe you're currently mimicing.

Any idea how I should do it?

I tried modifying the -1f and +1f to slightly bigger numbers but I just don't want to break it all and my trials fail aligning miserably the caret with the rest of the text.... ;)



  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Modify caret size
« Reply #1 on: February 09, 2014, 04:16:32 PM »
You were on the right track, but you need to change it in two places: line 1438 and 1599.