Just what the title says.
Thanks a lot.
Put the names in an array when you load
Seriously though, I don’t think there is a way other than keeping track of what you load.
Crazy. I was doing that in the beginning, but then I thought it’s not the proper way to do it.
Then I made a function using GetAllActorsOfClass to get all actors and their owner level. But I feel like that’s not very efficient.
Was wondering if there’s any other way.
I can understand why you want to know what levels are loaded, but why do you need to know which level each actor belongs to?
Because that’s how you find out which levels are loaded, no?
Well, when you stream a level, put the name in an array?
Yeah, I used to do that in the game instance, but when I need to access it from various actors or widgets, I need to cast to it all the time.
So I thought get all actors of class isn’t that bad, and I don’t have to rely on the game instance all the time.
What do you think?
For sure, GI is a good place to keep control of what levels you have, you can talk to it with an interface - no casting
When you say ‘get all actors’, which actors are these? ( I’m trying to figure out why you are doing that )
I mean ALL actors currently loaded, of class ‘actor’.
I know interface is another possibility, but I still need a reference to game instance, and it’s just another file I have to create and then implement the interface, and it seems so bloaty.
Get All Actors requires nothing, and can be run from anywhere.
I’m just trying to unload all currently loaded streaming levels.
Yeah, thanks. It’s the getting the names part that I needed help on. Meaning, getting them in other ways than array or get all actors of class, like I said.
But thanks, much appreciated.
By the way, normal loop doesn’t work with latent nodes. You need to create your own latent for loop macro. Something like this:
You’re right, can’t load or unload on a for loop.
I do use streaming, but never tried it in a loop
I just answered a very similar question, you can make your own copy of the Foreach macro and convert it to level streaming