Find the parent of a gameObject

I have looked everywhere and I cannot figure out how to find a child’s parent in script. In flash, director, javascript, etc. it is usually just _parent or parent. I have quite a few objects that are not being destroyed with Destroy(gameObject); - most of the objects need an empty parent GameObject to fix rotation issues that deal with local vs. world space, etc.

Anyone - know what I’m talking about here? ; )

if it helps … there is a parent property under the Transform component.

thanks for the quick reply, but yeah, I tried that… no go.

ok. i attached the script below for the following object heirarchy:

Capsule
   |
   |
   ----Cube
   |
   |---Cylinder
        |
        |--Sphere

function Start () {
		print("----------Tree for:" + name + "------------");
		FindParents( gameObject );
}

function FindParents( object ){
	if( object.transform.parent )
		FindParents( object.transform.parent );
	print( object.name );
}

Looks like i can get to print the entire graph correctly.

Okay cool, then I must be doing something else wrong ; ) which would NOT be a big surprise, haha.

Thanks for you help on this