2D Toolkit Forum
2D Toolkit => Support => Topic started by: shaolin23 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:
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.
-
What version of 2d toolkit are you using?
-
The last one - currently available in asset store...1.56 final?
-
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:
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!
-
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
-
No change, unfortunately.
Any other ideas perhaps? How can I test for asset load before instantiating my prefab clone?
Thanks in advance.
-
This implies that meshVertices is null. Another user had a similar problem. Could you try replacing the function with the one listed below, please:
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