Hello Guest

Author Topic: IOS td2kSprite_GetCurrentVertexCount Error...  (Read 9053 times)

shaolin23

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 5
    • View Profile
IOS td2kSprite_GetCurrentVertexCount Error...
« on: March 01, 2012, 07:12:59 pm »
Hi there,

Can someone help point me in the right direction for a fix? I'm running Unity 3.5, and receiving a "EXC_BAD_ACCESS" message / error through xcode debug when my first level containing my sprite collection loads:

Code: [Select]
Lm_b1:
tk2dSprite_GetCurrentVertexCount:

.byte 13,192,160,225,128,64,45,233,13,112,160,225,0,89,45,233,8,208,77,226,13,176,160,225,0,0,139,229,0,0,155,229
.byte 76,0,144,229,12,0,144,229,8,208,139,226,0,9,189,232,8,112,157,229,0,160,157,232

Lme_b1:

Any ideas?

Thanks in advance.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: IOS td2kSprite_GetCurrentVertexCount Error...
« Reply #1 on: March 01, 2012, 08:45:48 pm »
What version of 2d toolkit are you using?

shaolin23

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: IOS td2kSprite_GetCurrentVertexCount Error...
« Reply #2 on: March 01, 2012, 09:11:50 pm »
The last one - currently available in asset store...1.56 final?

shaolin23

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: IOS td2kSprite_GetCurrentVertexCount Error...
« Reply #3 on: March 01, 2012, 09:20:59 pm »
A bit of background on the project...please bear with me as I'm relatively new to unity & c#:

- I'm creating a clone of a prefab which is essentially a TK 2d Sprite, with rigid body, at Start.

- My sprite collection has about 40 sprites, all 256x256.

- Also at Start, I populate my prefab with a random sprite from the collection, using this:

Code: [Select]
currentObject.GetComponent<tk2dBaseSprite>().spriteId = (int) Random.Range(2, 41);
objectName = currentObject.GetComponent<tk2dBaseSprite>().GetCurrentSpriteDef().name;

- Works fine in editor game preview, fails in Xcode debug.

Thanks!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: IOS td2kSprite_GetCurrentVertexCount Error...
« Reply #4 on: March 02, 2012, 02:13:29 pm »
One thing I can think of is the sprite hasn't been awaken properly, before this function is being called. It is called in the spriteId accessor. Would it be possible to test calling Awake() explicitly, before doing the .spriteId call? This is just for a test, I do not recommend doing this to "fix" the problem.

Let me know how it goes

shaolin23

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: IOS td2kSprite_GetCurrentVertexCount Error...
« Reply #5 on: March 16, 2012, 08:11:34 pm »
No change, unfortunately.

Any other ideas perhaps? How can I test for asset load before instantiating my prefab clone?

Thanks in advance.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: IOS td2kSprite_GetCurrentVertexCount Error...
« Reply #6 on: March 16, 2012, 08:38:28 pm »
This implies that meshVertices is null. Another user had a similar problem. Could you try replacing the function with the one listed below, please:

Code: [Select]
protected override int GetCurrentVertexCount()
{
return meshVertices?meshVertices.Length:0;
}

This should return 0 - and the caller should force a rebuild.

Please get in touch with email if you want quicker support - support at unikronsoftware dot com