Hello Guest

Author Topic: Null error in tk2dTextGeomGen when calling .Commit() twice  (Read 3464 times)

LaserDinosaur

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 38
    • View Profile
Null error in tk2dTextGeomGen when calling .Commit() twice
« on: November 25, 2015, 01:59:58 pm »
Hi there

I'm using a tk2dTextMesh and calling Commit() because I need the bounds in the same frame.

However I seem to be getting an error in tk2dTextGeomGen.cs, method 'GetMeshDimensionsForString' in line 39:

'for (int i = 0; i < str.Length && target < data.maxChars; ++i)'


I get an object not defined (null) error in the str property. What's really strange about it is that the cause of it seems really unreliable. What I've found so far:

1) It only happens when Commit() is called twice on the same textmesh in the same frame.
2) Placing two Commit() calls right after each other works fine, it has to be an external class call
3) Not all external calls break it - it seems to happen more when being called through delegates, but not all the time.
4) I setup a blank project and can't seem to replicate the issue, which I realize makes answering this question a lot more difficult.

My only guess is that when Commit calls FlushQueues, perhaps the delegates are firing at the same time (as far as C# is concerned anyway), removing the text mesh in the wrong order and causing an issue. I'm not sure, it's very weird.

Any advice on what might cause this method to fall over? I'm using tk2d 2.5.4 and Unity 5.2.0f3.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Null error in tk2dTextGeomGen when calling .Commit() twice
« Reply #1 on: December 06, 2015, 12:21:38 pm »
Is there any way to reproduce this at all? Calling commit immediately is fine and used to be the only way to do this. If you can repro, email support and I'll investigate this for you.