Instantiated object's Animator stops transform.position updates

I have a test character made of sprites animating. I add this

void Update(){
        transform.position += new Vector3(0.03f,0,0);
    }

On a character in the level, it moves and animates.

On a character I instantiate from Resources, it doesn’t move; it stands on the spot animating. If I disable the Animator on the instantiated object though, it moves.

Edit: If I spawn the object at (0,0,0) it works. If I spawn anywhere else, it doesn’t move with the Animator active.

If I spawn the object at (0,0,0) and then immediately move it to a new start location, it also works correctly. Unity 4.5.5p2

Edit: And now 4.6.1f1

Seriously, this must be a common issue! Are people not using animations?! Or is everyone spawning at (0,0,0)?

Normally you shouldn’t update your root game object transform in Update function but in OnAnimatorMove().

If your animator has some root motion curve and applyRootMotion is checked then it is expected that anything set in root transform object in the Update function won’t move your object.

Thanks. Is this covered anywhere in a tute? Every example for Mecanim I’ve found is either talking about importing FBX’s with animations or using physics. My game is grid based and very simple, no physics needed. I just lerp from tile to tile. But getting my head around this animation is proving very hard because none of the info matches up with what I’m trying to do. :frowning:

Edit: Is it safe to chuck all animated graphics into a child object and control the parent for position?

Hey Geezer - the solution you mentioned was the thought I had when I read your OP. Don’t know if it’s the right one but that was my first thought to fix the issue you were experiencing.

Post the solution you end up using.

Yes that should work.

Yes. That actually seems the right thing to do in general regards anything but the simplest Unity GameObjects! :wink: