Hello Guest

Author Topic: tk2dFontData.chars is empty: IndexOutOfRangeException on TextInput  (Read 5308 times)

Allen

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 6
    • View Profile
Hello,

You can download a project that exhibits the problem here: Link removed

Type a space into the text input and you will get an index out of range exception because tk2dFontData.chars is empty. I am using a custom font that was generated from BMFont which is included in the attached project. It has been created in a sprite collection with all three platforms.

I am using 2D Toolkit 2.4.0.

This is the stack trace:

IndexOutOfRangeException: Array index is out of range.
tk2dUITextInput.SetCursorPosition () (at Assets/TK2DROOT/tk2dUI/Code/Controls/tk2dUITextInput.cs:426)
tk2dUITextInput.set_Text (System.String value) (at Assets/TK2DROOT/tk2dUI/Code/Controls/tk2dUITextInput.cs:158)
tk2dUITextInput.ListenForKeyboardTextUpdate () (at Assets/TK2DROOT/tk2dUI/Code/Controls/tk2dUITextInput.cs:304)
tk2dUIManager.Update () (at Assets/TK2DROOT/tk2dUI/Code/Core/tk2dUIManager.cs:324)

Please let me know when this is resolved so I can re-generate my font to not have this problem.

Thanks,
Allen
« Last Edit: March 31, 2014, 10:51:47 am by unikronsoftware »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: tk2dFontData.chars is empty: IndexOutOfRangeException on TextInput
« Reply #1 on: March 31, 2014, 11:15:43 am »
Hi this looks like its a bug with uitextinput and platform fonts.
Bugfix attached:

Allen

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: tk2dFontData.chars is empty: IndexOutOfRangeException on TextInput
« Reply #2 on: April 02, 2014, 10:13:03 pm »
Thanks! ...Except I can't for the life of me find your attachment! Would you mind re-attaching?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: tk2dFontData.chars is empty: IndexOutOfRangeException on TextInput
« Reply #3 on: April 06, 2014, 12:09:39 pm »
Hi, Are you still having issues seeing the attachment?

Allen

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: tk2dFontData.chars is empty: IndexOutOfRangeException on TextInput
« Reply #4 on: April 06, 2014, 04:10:15 pm »
No, I can see the attachment now! Thanks for your help.

I'm sure it's my fault that I didn't read a sticky somewhere that you need to be a part of the group... But if there is any way to mod the forum so that it shows "Attachment hidden because you're not a part of the group" message where the attachment would normally be, that would definitely be a little less confusing.

Thanks for your hard work, I'll give this fix a try...

Allen

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: tk2dFontData.chars is empty: IndexOutOfRangeException on TextInput
« Reply #5 on: April 06, 2014, 04:34:14 pm »
Yep, that fixed it! Thanks for your help!

While looking at this bug, I also noticed that TOUCH_SCREEN_KEYBOARD is not defined for UNITY_BLACKBERRY... To me this suggests that Unity doesn't support blackberry's touch keyboard, but I don't think that's true.

Anyway, I'll give it a shot sometime latter so see if it is supported or not. Thanks again!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: tk2dFontData.chars is empty: IndexOutOfRangeException on TextInput
« Reply #6 on: April 07, 2014, 06:22:28 pm »
Hi it should probably be ticked, but I don't have Unity blackberry or any blackberry devices to test this on, so the official line is - we don't officially support that platform. It should work though, and you're right you'll need to add that define.

Allen

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: tk2dFontData.chars is empty: IndexOutOfRangeException on TextInput
« Reply #7 on: April 07, 2014, 06:26:08 pm »
Ah, perfect, I'll give it a shot. :) Thanks again!