Get Child Components Returning Element's Bottom-Up Instead Of Top-Down?

Hey Guys,

I’m getting a weird issue here. When I am calling the ‘Get Child Components’ node it appears like it is returning the items from the bottom-up instead of top-down. I’m going to do more testing but I posted this last night then deleted it after I saw an instance where it was working but now it seems like its back from the dead. If I am not mistaken, the array has always come back top-down instead of the other way. I am currently using version 4.5.0 of the engine.

Thanks!

Okay, now I’m really confused lol. Now it’s returning the child elements top-down. I think there is a bug but I’m really confused what is causing it.

EDIT: Man this doesn’t end. Now, I’m even more confused. So as I’m typing this, I went to my Blueprint to where it was about to ForEach on the array returned from the ‘Get Child Components’ node to watch the variable to confirm it was indeed returning the elements top-down, and the thing goes bottom-up and then starts going back to not working. Man, this one is making me loose my mind lol. I’ll try to look at the source on the engine and see if I can figure it out but if someone could help out, that’d be great. Thanks!

After some research, I looked through the USceneComponent class and haven’t noticed anything yet. It appears there isn’t anything out of place with: OnRegister, AttachTo, etc. My guess right now is it could be related to some Blueprint Editor specific code that starts initializing all of the components attached to a USceneComponent and could be tripping up switching the order it sees it’s AttachChildren. I need to look at the Array Append function a little more to see if it possibly could be that but I’ll try to spend a little more time with this so I can hopefully get past it, thanks.

I tried looking at things but it’s going to take a while to understand what is going on under the covers. I did look at the Append function and nothing wrong that I can see. My only guess it’s its the code that when reading a BP Asset and composing the Components Graph, that it is having an issue somewhere there. Anyways, hope this helps and let me know when someone can take a look at this. Thanks!

Okay, so this might help. It works fine in Standalone but not within the editor both when playing in viewport and an external window. But if I run that level in Standalone, it returns the items top-down and works as expected.

Hi ,

Can you show me a screenshot of your blueprints?

Hey , absolutely. Already took it. I’m in the process of uploading my prototype to OneDrive and I already put it in there but it could be sitting in the queue at the end which may take a while. But I’ll post it as soon as it’s live.

So aside from it working differently, get this… when Packaging my Project for a Staging build, it was completely out of order instead of top-down or bottom-up.

What I am going to have to do unless it’s possible that it could be made to be predictable, is since these are based off of custom native types I created, I could just create an additional variable that serves as an index for a given item’s order in the chain and then sort them that way but let me ask you, is it by design supposed to return the list of children elements in a specific order or is it unpredictable due to the nature of the beast? Other than that, hope all is well .

Hey , here is a screenshot of the area of the BP, it’s right when I’m trying to ForEach loop over the elements in the array coming from the Options variable which a SceneComponent. Basically I have a base class called MenuActor that includes all the functionality for a parent class to make it work as a menu simply by adding ChildActorComponents to various SceneComponents. I have SceneComponents that are called MainMenu, Options, etc that when I inherit a class from that, it automatically scans all the children, sees if they are an appropriate type (for actions like focus, unfocus, selection), then does A, B, and C to get the result.

Yesterday, there was an instance with playing it in the editor, where it was top-down so it appears to be completely unpredictable unfortunately. But hope the image helps and let me know if you need anything else , thanks again!

Try setting an int variable for the Array Index, that after each loop increments by one until it reaches your array length, in which case it resets. I want to see if you can force it to a top down method.

Sorry about the delay , I’ll give this a shot today or tomorrow and let you know the results. Hope you are having a great weekend.

Okay . Just tested it and unfortunately it’s still unpredictable. When I added the ForLoop just now and iterated over all 12 elements that came back in the array from GetChildrenComponents, it was bottom-up in this case. I don’t really know if there is a definitive pattern here. It looked that originally but after seeing it work once in the editor and come back completely out of order when publishing a build, I am not sure what’s happening. Like I said though, if worse comes to worse, then I’ll add the additional int to store a sort index and doing some form of pre-sorting before they are added to the array that stores those references. But let me know if you guys need me to test a couple other scenarios. Take care bud

,

Do you have a stripped down project that I could have a look and see this occurring live? I would be more than happy to have a look!

That’s a good question. I would probably have to separate some of the content but I can go ahead and provide you some of the compiled uassets in case that is quicker. I am not at my dev machine but tonight I’ll up some of them tonight. If you end up needing more, even though the game is in early dev, I can get you the files through PM. That could be the better of the two options as I can send you that broken level with all the dead references to past files in case the team is still investigating issues with the linker. But I’ll get you the files tonight with a basic rundown on how I implement them but it will be easy and quick for you.

But the base class that’s used in all of this is the one with the issues so hopefully that’ll provide you enough to check it out. Thanks , I really appreciate how awesome you guys are over there and between you, TJ, , Sean and a couple others, you’ve been really committed and I can’t thank you enough for that. It really goes to speak volumes about how committed Epic is to their developers. And I want to do what I can to help you guys make the engine better if I can in any way.

I’ll get that over to you tonight and enjoy the rest of the day.

Okay , I’ve got the file zipped up on my OneDrive. I’m going to head to the forums and send you a PM, thanks again.

,

We are always willing to help when we can. Unfortunately the assets you sent me have lost all references, it may be best to send a test project with the “working” assets so I can see what is going on. In their current state I won’t be able to do anything of significance, unfortunately.

Yea I figured that could be the case and actually forgot to provide you details on how to use it. Okay, I have no problem getting you the project and i may create a separate one with just the assets in question. It may take me a day or two to get something together for you. Hang tight and thanks again , you rock buddy!

Hey , sorry about not getting back to you sooner for your tracking purposes. I unfortunately have been tied up trying to move from the prototype phase to fundraising to get the my company off the ground and time is unfortunately of the essence so I’ve had to take a step back from it for a little. I have sporadic time here and there so I will try to move assets over into a separate project and get that to you as soon as I can but thank you for all your help and I’ll keep you posted if I can get that to you soon. Thanks Again!

,

We have not heard from you in quite some time. I am marking this thread as answered for tracking purposes. I understand that you have a lot on your plate, so I do not mind waiting to get the project. Respond here whenever you do get it uploaded and I’ll be more than happy to take a look. Thank you!

Absolutely , been too busy but I will absolutely revisit this in the near future and maybe by then, it may be already resolved. I’ll check in with you again as soon as I get a chance. Take care .