- Home /
2D sprites animation is not working - using tiled texture extended.
So I'm using this script as reference http://wiki.unity3d.com/index.php/Animating_Tiled_texture_-_Extended
I want to change the animation from idle to walking when I move my joystick. I know that I need to change the rowNumber and I already tried to do that. The rowNumber indeed changed, but when I play the game on the editor, the animation didn't change at all. What did I do wrong? Thanks in advance :)
Here's the code I'm using to change the rowNumber:
PlayerAnimate.cs
public class PlayerAnimate : MonoBehaviour {
public AnimateTexture at;
public Joystick joy;
void Start() {
at = new AnimateTexture();
joy = new Joystick();
Debug.Log(at.rowNumber);
}
void Update() {
if(joy.position.x == 0 && joy.position.y == 0) {
at.rowNumber = 2;
}
Debug.Log(at.rowNumber);
}
}
Why not use $$anonymous$$echanim animation system? Here is good learn material to start with: http://unity3d.com/learn/tutorials/modules/beginner/2d/2d-controllers
That is strange I have a problem with the sprites not working. Did you make the sprite sheet right? $$anonymous$$y problem is that the sprites don't animate right at all. I don't think you wrote the right code or someone gave you an out dated code. Did any errors pop up? You should make sure that the sprite sheet code options pop up(Columns, Rows). You can still use the joystick.
Your answer
![](https://koobas.hobune.stream/wayback/20220613135843im_/https://answers.unity.com/themes/thub/images/avi.jpg)