Search Unity

Can't animate a sprite change for a UI Image while moving it?

Discussion in 'Animation' started by EdKirby, Sep 17, 2019.

  1. EdKirby

    EdKirby

    Joined:
    Nov 15, 2013
    Posts:
    43
    Hi!

    I'm trying to determine if this is a bug or if we just can't do this.

    I have a requirement to change an Image's sprite during an animation where I'm already moving its anchored position. As soon as I add the sprite property for the image it breaks the move animation. Meaning, it immediately changes the x and y settings in the Anchored Pos for the animation to some arbitrary pos. I haven't even tried to change the sprite yet or hit play. Once removed it immediately reverts back and the animation works correctly.

    In this "broken" state, if I try to move the go in the scene, it springs back to the position that was arbitrarily set when I added the sprite property. It won't let me move it. The game is not in play mode.

    It has a RectTransform as an image would, not just a regular transform and I only mention this as I've tested it with a regular old transform and sprite renderer and it works just fine. It also works fine if I only try to change the sprite without moving it. I've also tested with with some of the other image properties and likewise it works OK, just not with the sprite property.

    Unity 2019.1.0f2 Standalone build.

    Thanks in advance!
    E
     
  2. EdKirby

    EdKirby

    Joined:
    Nov 15, 2013
    Posts:
    43
    Nobody's run into this?