Search Unity

Question KeyFrame Sprites Are Duplicated

Discussion in 'Animation' started by andromedial, May 17, 2023.

  1. andromedial

    andromedial

    Joined:
    Dec 31, 2022
    Posts:
    1
    Hi,

    I modified a script I found to take a spritesheet, cut it, and turn it into an AnimationClip. When I step through the code, everything seems to be in order, but once the AnimationClip is created and I go to preview it on my player, or in game, all of the Keyframes have the same sprite (for example, below both keyframes 1 and 2 have the same value for Sprite). And the sprite will be the first expected sprite of that animation:

    upload_2023-5-16_16-6-19.png

    upload_2023-5-16_16-6-50.png

    If I change directions while playing the game, it will update the player's sprites to be the very first sprite of the animation in that direction. When I debug, however, the list of sprites and spriteKeyFrames hold the expected (correct) values:

    upload_2023-5-16_16-7-39.png

    does anyone have any insight into what might cause this? I'm at a loss