As mentioned in the title, when I want to call the “.children” function on an entity that has children generated by a script, I got an empty array. When I want to call one of the children, I got an empty result (undefined).
I think that’s to be expected, your SpawnEntities entity comes last in the hierarchy, and it will spawn entities after the cameraPath.js initialize method ran.
So when you print the console log in that script, indeed the children property is empty.
If you try printing it at a later time you will see it filled, here is me doing this in the browser console:
So the scripts loading order defines the order in which your scripts are getting attached to the applications (to the HTML document).
That is useful for example when you are attaching 3rd party libraries that execute outside of the main app cycle (initialize/postInitialize). In that case putting them on top of that list will make them available to be referenced in your scripts.
The initialize/postInitialize/update execution order will always be from the first entity in your hierarchy to the last one.