Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question Animate plant shake 2D

Discussion in 'Animation' started by Daviiid, Dec 27, 2022.

  1. Daviiid

    Daviiid

    Joined:
    Oct 9, 2015
    Posts:
    50
    I have a plant that's meant to grow in 4 stages like when it's planted, when it's flowering, when it has some fruit... It can also be highlighted by mouse over in all 4 stages, that's 4 extra sprites.
    So I have 8 sprites in total. All the changes of the growing plant and being highlighted are done by code through SpriteRenderer.sprite change.

    Now the thing I want to do is make the plant shake a bit when it collides with something. First I thought that I would add a skeleton to the plant, but I don't think I can do that. through the skinning editor. Since I have 8 sprites of the same thing in the image. Just different stages of it.

    So can I somehow make the plant shake from the GameObject side? so even if I change the sprite by code the animation would just continue? Like when you change the scale or rotation of a game object.