an animate parent GameObject

hello,
I am doing a pick-up stick game. I got an animated Hands which do all the animation.
In two animations, the hands supposed to grab a stick or two and move them all the animation.
I created a stick and parent it to the hands but when Hands do the animation, the stick doesnt move.
here is the function:

	void DoAnimation(){
		if(corretlymodeIndex==4){
StickForAnimationPreFab=Instantiate(StickForAnimation,GameObject.Find("StickPlace#2").transform.position,Quaternion.Euler(0,0,90)) as GameObject;
				StickForAnimationPreFab.transform.parent=Hands.transform;
				StickForAnimationPreFab.parent.animation.CrossFade(animationNames); // i tryed to do this because it wrotten somewhere that it is slove the problem but i have a error:

			}
			else if(corretlymodeIndex==5){
				Hands.animation[animationNames].speed=5;
				StickForAnimationPreFab=Instantiate(StickForAnimation,GameObject.Find("StickPlace#2").transform.position,Quaternion.Euler(0,0,90)) as GameObject;
				StickForAnimationPreFab.transform.parent=Hands.transform;
				StickForAnimationPreFab=Instantiate(StickForAnimation,GameObject.Find("StickPlace#3").transform.position,Quaternion.Euler(0,0,90)) as GameObject;
				StickForAnimationPreFab.transform.parent=Hands.transform;
			}

			
			Hands.animation.CrossFade(animationNames);
			Time.timeScale=0.2f;
		}

please help me…:face_with_spiral_eyes:

StickForAnimationPreFab.parent.animation. … is wrong

Like the Error say UnityEngine.GameObject does not have a definition for parent.

But like in the line above :
StickForAnimationPreFab.transform.parent. … works fine.

just make

StickForAnimationPreFab.transform.parent.animation.CrossFade(animationNames);

i did what you said.
The stick starts the animation but it doesnt following the currect place it should be.
then I did in the update

if(StickForAnimationPrefab!=null){
StickForAnimationPrefab.transfrom.position=Hands.transform.position; //Hands is a gameObject that i said Started it before
StickForAnimationPrefab.transfrom.rotation=Hands.transform.rotation;
}

well after some fixing about the postion itself, it did it right :smile:

thank you for your reply and have a great new year.