Problem with character movement 2d when attaching animator

I made a character using spritesheet animation concept, than decision was made to switch to animating character using separate body parts like in this tutorial: Bone-Based Unity 2D Animation: Introduction

The character made using spritesheet animation is working perfectly fine.
But with the new character i am encountering strange problems.
I am trying to move both characters with the same script and attaching the same components to them:

  1. Circular colliders at feet, some other collider on top.
  2. Both have Rigidbody2d component attached to them. Fixed Angle is checked, Is Kinematic is unchecked.
  3. The same script to control movement is attached to both characters.
  4. Two different animator components because of different nature of the animation. In the first case animation was made manually in photoshop as a spritesheet. In second case, there was a file with body parts, and annimation was made in unity using mecanim.

The initial conditions are: the character is placed a little above the platform, so when the game starts, it should first fall and touch the ground, then walk on the platform.

I encounter following problems with character made with body parts:

  1. When Animator component is not attached or disabled, character is moving correctly, falling to the ground correctly, as determined by Rigidbody2d component. But of course no animation is happening.
  2. When I enable Animator component with the controller and all the animations i made using mecanim, character stays in mid air, and does not move anywhere, does not respond to controls, but flipping the character works, and proper animations show when trying to walk to one direction or another, but there is no actual movement. Update mode on the animator is set to Normal, Apply Root motion is unchecked, but checking it does not make any difference. Culling mode is Always Animate. The same settings work with the first character.
  3. When Setting update mode to Animate Physics, the Character start to jiggle heavily. It is also now trying to fall to the ground, but after lowering a little bit, returns to its initial position above the platform.

I tried using following code to move the character (both variations work on the first character (one that uses spritesheets)):

rigidbody2D.velocity = new Vector2 (move * maxSpeed, rigidbody2D.velocity.y);


transform.position += transform.right * move * maxSpeed * Time.deltaTime;

I feel like I am missing something out, or did something wrong with animations on the second character. Any ideas?

I have figured out the solution that worked for me.

First, I have created an empty game object and parented my game object to this newly created one.

Second, moved all the components from my first object to its parent, except for Animator component.

And it worked!!! Also had to rewrite my code a bit. When searching for Animator component had to change function GetComponent for GetComponentInChildren.

Hope this helps someone.