This all works great if the level intersection only needs to load and unload a single level, but if I have more than one level in my array for loading or unloading, only the first element in the array is processed, am I doing something wrong?
The arrays are of type Name and contain the level names.
Yes that is the reason … unfortunately none of the built in loops allow a wait until last loop execution finishes as far as I can tell so had to build my own
I guess you can do it similar to this example. I took your variables names for easier understanding.
To get the Complete into the for loop i just made my own for loop. So i used a Get Node for the Array and a selfmade index. Everytime the Load/Unload Steam Level node is completed, i increment the index by 1 and check if it’s still lower than the length of the array. If yes, we load the next level etc. If no, we set index back to 0 and start with the Unload Stream Level node. Same here, if completed, increment index, check, repeat or finish.
Also set the index to 0 before starting with everything. You could also do it before the Switch to have one less “Set Index” node. But i made this fast to get you started
You may want to check if the Level Load List is not 0, because this setup works only if you have at least 1 Level Name in that array. If it’s empty he will try to get index 0 which isn’t available and throw an error.
Another idea to make it wait, haven’t tried it yet:
Add something like an arbitrary “Set” to a variable, or some similar “NOP” action, and connect it to the “Completed” node of the “Load Stream Level”.
IMO the loop should wait for that last action before running the next itaration, and that action is only fired after the load is completed… might be worth a try.