How can I determine the parent of a component?

I need to find out (with Javascript) how to determine the parent object that a Skinned Mesh Renderer component is attached to.

I'm instantiating some character prefabs and the Skinned Mesh Renderer isn't always attached to the same bone in the character heirarchy, so I want to be able to determine which bone object actually contains the Skinned Mesh Renderer.

I can find it no problem with "characterObject.GetComponentInChildren(SkinnedMeshRenderer);" but once I do that I need to know which actual bone in the character contains that component.

SkinnedMeshRenderer inherits from Renderer, which inherits from Component. As such, this is easy:

http://unity3d.com/support/documentation/ScriptReference/Component-gameObject.html

At least, I think that's what you're talking about. If you actually want a parent object, and not the Game Object that has the Skinned Mesh Renderer attached, then you can use

http://unity3d.com/support/documentation/ScriptReference/Transform-parent.html

So you need the GameObject that holds the Component you can find.

http://unity3d.com/support/documentation/ScriptReference/Component.html

So from Component you can get the transform for the GO.

comp.transform

http://unity3d.com/support/documentation/ScriptReference/Transform.html

From the Transform you can access the entire GO

comp.transform.name // etc

I havent tried it. I'm assuming getting the name of the transform would get you the name of the GO. Maybe comp.name gets you the name of the GO.