2D Toolkit Forum

2D Toolkit => Support => Topic started by: edb on July 01, 2016, 01:03:20 am

Title: Changing the color of a tk2dClippedSprite causes stray mesh to be created
Post by: edb on July 01, 2016, 01:03:20 am
I'm tracking down stuff in the Profiler and noticed that something was creating unreferenced meshes in the Memory/Detailed/Not Saved/Mesh section.
These meshes don't seem to be ever get deleted.  I've traced it back to when I change the color of a tk2dClippedSprite with the statement theSprite.color = theColor
That in turn calls tk2dClippedSprite/UpdateColorsImpl(), which then calls Build(), and in Build() it seems is where the stray mesh is created.

I know tk2dClippedSprite is the culprit because in the Build() function of the tk2dClippedSprite I did a test with mesh.name = "Stray Mesh";  and the Profiler
showed extra stray meshes that never get deleted with those names being created every time I entered my scene.

Any ideas?  I'm on Unity 4.7.2. and 2d Toolkit 2.5.0.  Thanks.
Title: Re: Changing the color of a tk2dClippedSprite causes stray mesh to be created
Post by: edb on July 01, 2016, 01:01:02 pm
Ok - I was able to fix this problem by starting the scene with the tk2ClippedSprite in the Unity editor checked on to be visible/active.   The problem was happening when the scene started with it off/invisible.
Title: Re: Changing the color of a tk2dClippedSprite causes stray mesh to be created
Post by: unikronsoftware on July 13, 2016, 10:53:40 pm
I'll investigate this, it shouldn't exist if it is not visible / active.