Hello Guest

Author Topic: Animations are not showing up  (Read 4086 times)

bam191

  • Newbie
  • *
  • Posts: 3
    • View Profile
Animations are not showing up
« 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?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Animations are not showing up
« Reply #1 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?

bam191

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Animations are not showing up
« Reply #2 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?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Animations are not showing up
« Reply #3 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.

bam191

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Animations are not showing up
« Reply #4 on: September 15, 2013, 10:38:37 pm »
Ah, it worked! Thank you very much!