Level stream and spawned objects

ok, well i need soon go to sleep lol been sitting with this same problem now for 15 hours, but glad you like to help and if you can find a good way to fix this just tell me :). I just get so confused with this cast to and what objects to use lol. I think it would be easy to just get the name of the fractured cube, then just delete that index from the array, but how get the name :D. Well Have to sleep but thanks allot for taking your time :slight_smile:

Here is a short video going over how to handle loading and unloading streamed levels and setting up an array to clean spawned items. UE4 Tutorial: Removing spawned objects with streamed level - YouTube

1 Like

Not a problem! I’ll figure some things out and post screens for you.

Thank you very much for that response, very impressive to get answer on video:) yes i now manged to fix that problem, but right now the problem is that i will be able to attack this cubes and after a few seconds they are re spawning, so i need to take control over the array so that it deletes the index from the array that holds the name of the cube i just attacked and destroyed. Cause if i dont do that and i unload that level, it will try to destroy a cube that actually is not there :). Hope you understan how i mean :).

Thanks allot :slight_smile:

Run an “is valid” node before “destroy actor”. Then when the “for each loop” is complete run “clear” to empty the array.

Thanks for that response, i will try that, the thing is that i actually dont get any problems with the game if it try destroy actor that not exists, what i was thinking about was that as long as the player stay on same level fighting this cubes it will fill up that array allot with not existing cubes (wich i dont want to destroy from array until i unload that level) , but i guess that will not cause any bigger problems or fill the memory to much :).

Yeah, you would have to spawn a lot of cubes for an array to have any significant impact on performance

I made some funny experimenting in this, and wrote the output from the stored names in the array to a print text. What i discovered was that the array itself seems to delete the indexes that not really exist :D, i was so surprised cause i could not understand that the indexes some times disappeared after i really destroyed the actor after attack. Then my problem is no more a problem :slight_smile: if i am right :D.

that has to do with that the array is just a reference of the actor? so when actor destroyed the index of that actor also destroys. I think?