2D Toolkit Forum

2D Toolkit => Support => Topic started by: bam191 on September 15, 2013, 02:26:24 pm

Title: Animations are not showing up
Post by: bam191 on September 15, 2013, 02:26:24 pm
For some reason, I can't get animations to play in 2d Toolkit. Or rather, more accurately, they play but don't show up in game.

I have a simple sprite (following the various guides for creating sprites and cameras of course), and I put a sprite animator onto it. I made a sprite animation, set it to loop, set all the options correctly, and made it play on start up. When I start the game, my sprite just sits there doing nothing at all. If I switch back to editor view, I can see that the collider is moving, but the actual image doesn't change. It changes in the preview on the side menu, but when it comes to the actual world editor, it doesn't change in the slightest.

What am I doing wrong?
Title: Re: Animations are not showing up
Post by: unikronsoftware on September 15, 2013, 10:00:06 pm
Do you have anything set up in your code to manipulate this sprite? Specifically, do you or any other script you're using by any chance access MeshFilter.mesh?
Title: Re: Animations are not showing up
Post by: bam191 on September 15, 2013, 10:18:33 pm
Yes actually, my physics script accesses MeshFliter.mesh to get the bounds for it. Is that what's causing the problem?
Title: Re: Animations are not showing up
Post by: unikronsoftware on September 15, 2013, 10:28:59 pm
Yes. Calling .mesh will mean it creates a copy of the mesh, and tk2d will be updating the wrong mesh from that point on. You should use .sharedMesh instead., that doesn't create a copy like .mesh does.
Title: Re: Animations are not showing up
Post by: bam191 on September 15, 2013, 10:38:37 pm
Ah, it worked! Thank you very much!