Download

GetChildrenComponents doesn't work in interface function implementation

Hello, everyone!

I’m using only Blueprints in my project.
I have the BPI_Translucent interface with one function SetTranslucency, which receives boolean parameter with new value of actor translucency and returns boolean Success.
You can see the implementation of this function in one of my blueprints, which implements this interface

The problem is that call to GetChildrenComponents of Floor Static Mesh Component return 1 or even 0 child components, but actually it isn’t. And, what is the most interesting, GetNumChildrenComponents return actual number of child components, but not recursively, without children of child components.

s3

I’ve put all this nodes in another function inside my blueprint and it works, GetChildreComponents returns all children. It also works if I just call this function inside the implementation of SetTranslucency interface function.

So, why does the GetChildrenComponents function return not all child components when it is called inside the interface function implementation? And how can I fix it?

Hello there!

I don’t want to be this person, but I have no other idea than just help you figure it out yourself. You already did a decent job there trying all the options. Let me try.

  1. How are you calling the interface?
  2. Are you sure you are looking at the “GetChildrenComponents” output? There is a cast, which should success as you have static meshes, but then you are checking tags, which you might have forgotten to add to all the components?
  3. Maybe the debugger is not showing you the loop repetitions, I found it really annoying. Try using “get out of function” button instead of “continue” on the debugger.

Reply and I hope we can keep figuring it out then.

1 Like

Oh, sorry, I have forgotten to write here about the ‘solution’ :pensive:
Sorry for my carelessness!
The code is fully workable. I connected SetCollisionResponseInChannel nodes to Return Node in loop body. So, after first loop iteration it calls the return node.
The another function, in which I placed this code, was without the return node.
Very stupid mistake :pensive: :pensive:

Well, I didn’t notice it either. Do not worry about it too much, it happens sometimes. Good luck with the project!

1 Like