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.
  2. Dismiss Notice

New to Unity, doing Ruby's Adventure tutorial, help with sprite animation please

Discussion in '2D' started by SaltpeterTaffy, Jul 29, 2019.

  1. SaltpeterTaffy

    SaltpeterTaffy

    Joined:
    Jul 27, 2019
    Posts:
    3
    A few days ago I decided to pick up Unity and so far it's been going great. I'm already comfortable with Java, so C# isn't too foreign to me, and the editor is intuitive. I'm up to the Sprite Animation part of the tutorial, and I've followed all the instructions exactly. When the animator is not attached, the sprite appears between the boxes as expected and moves as expected(left to right), it's just not animated. When I add the animator to the robot sprite, it offsets the sprite up by about half a unit(but not the hitbox!). Here's a bird's-eye view of my situation:

    https://imgur.com/a/yhr1lDk
    Robot in scene at intended starting location.

    https://imgur.com/a/GOtEplz
    Robot in play translated up.

    I've redone the animator controller for the robot. If there's something wrong with the animation itself I can't figure it out.

    https://imgur.com/a/Kd9JezD
    Crop of animation screen for down movement.
     
  2. ed_s

    ed_s

    Unity Technologies

    Joined:
    Apr 17, 2015
    Posts:
    165
    SaltpeterTaffy likes this.
  3. SaltpeterTaffy

    SaltpeterTaffy

    Joined:
    Jul 27, 2019
    Posts:
    3
    Thank you! For anyone also looking for the solution to this one, after some digging I found the solution in the thread here:

    https://forum.unity.com/threads/rubys-adventure-2d-beginner-official-thread.661837/#post-4575835

    The problem was that the original imported sprite did not have its pivot set to bottom. The animation's pivot is set to bottom, causing a discrepancy of half a sprite height between the location of the sprite and the expected location for its animation.
     
    Last edited: Jul 29, 2019
  4. MCOldGeek

    MCOldGeek

    Joined:
    May 21, 2013
    Posts:
    2
    Thanks for this, I kept trying different things and even had to reimport stuff before I found this thread. Thanks @SaltpeterTaffy for posting that.