Get blueprint component's parent

Hi there,

I’m trying to get the parent component of an object in my blueprint hierarchy. However all the function nodes I’ve found don’t seem to do this.

The closest I’ve found is the ‘Get Parent Component’, but the output is an array. Also, when I tried it out it didn’t seem to give me the hierarchy parent. (I could definitely be doing something wrong.) It gave me the root parent at the very top. Attached is an example hierarchy – how would I get the parent of SM_Lamp_Ceiling (PointLight1)?

Thanks,
John

3939-blueprint+hierarchy.png

Hello,

In the array created from “Get Parent Component”, if Element 0 was the Root, what was Element 1? Could you drag off the array and make a For Each Loop to print the contents of the array? That will let you see what all was in the array. There is a good they were populated in order of hierarchy.

Once I have more information, I will be happy to further assist you.

Cheers!

Hi ,

Thank you for the reply. I wasn’t able to exactly replicate the graph you have. But I think this is similar (although a bit more manual). I couldn’t get the ForEachLoop’s array element to convert to the print string input like you have pictured.

So in the overall graph, I’m doing a multi line trace. From the first object hit I’m getting it’s component, and then after that I’m getting the Parent Component as you specified above. After that I’m just manually setting the component in the array I want to grab and print the name for. Getting index 0 gives me the root of all the components. However setting it to 1, or 2, etc. prints nothing it seems – even though there are definitely other components between the one I’m hitting and the root one. I’m scratching my head a bit. If I remove the Get Parent Components portion it prints what I’m hitting – as expected.

Any help would be much appreciated.

Thanks!
John

Hey jmalaska,

To answer a couple of questions you’ve asked here:

  • For the conversion node used between his Return Value and the Print String, you can drag off the Return Value node and search for To String to get that node.
  • For a specific SceneComponent that you want to find the parent component of, you can use the Get Attach Parent function to return the SceneComponent in question. If you try to call Get Attach Parent on the actual Root component of the blueprint, the returned value will be None

Try using that function and if you still have trouble implementing a solution to your problem, let us know and we’ll work with you.

Cheers,

Hi ,

Thanks for the reply and the heads up on the To String node.

I had to wrangle my work a bit, and it looks like both of these solutions – both the Get Parent Component and Get Attach Parent work. I think there was something wrong with my scripting outside of this but they both do the trick now.

Thank you,
John

hi i want to do this in C++, can you help me?

Hi ddramin,

You will want to make a new post for that in the C++ section. If you post a link to it here, I will be happy to have someone look into it.

Thank you,