How would I move a game object vertically using an animation from current position?

I have a group of objects that sit in a row. I’ve set up an Animation Controller on them and when a trigger is hit, I want to move a single object vertically to visually separate it from the group from where it is currently located.

My Animation Controller has two animations, “Idle” and “Selected”. The “Selected” animation uses the game objects transform.y property to move the object and that works fine. The issue is that the values are static and I cannot move the game object at all (like its locked in place). Is there any way to allow the game object to be placed anywhere and have the animation move it from that location?

I basically just want to achieve a “lift” affect. I could achieve this by modifying my sprite sheet to just have the sprite “higher” but that seems kind of silly.

I answered a similar question here: How to apply a movement animation while maintaining scripted movement? - *SOLVED*

The reason the object is stuck in place is because you’re trying to control it both with animation and script (you also won’t be able to move it in the scene while the game is running). Animations take priority over everything else, so if an object’s position is animated, you won’t be able to move it via other means.

The easy way around this is to create an empty parent object and move that around instead. The position of the child will follow, and any animations the child has will be relative to the position of the parent.

Just check out the video in the link I posted for a demonstration.