I have a global logic object that keeps track of every streamed level in the game, and allows NPCs to travel through unloaded levels without actually streaming them in. To do this, I need to generate a list of every streamed level in advance, so the simulation has a way of “seeing” the game world. Since all streamed levels can be seen in the editor, I thought the smart way to accomplish this would be to use Blutility to make an event I could execute from the editor to find and register every level:
This does exactly what I want it to: it registers every Zone actor in the game, so if I place one Zone per streamed level I have an instant indicator of when a level loads/unloads, and of what assets (like transient characters) should be instantiated in that level.
However, it only retains the results from the first time I run it: you can see that I’m adding the results to some TArray<FZoneData> ZoneList, which is intended to be the universal holder of everything level-related, and ZoneList will only retain the values it gets once- if I have two zones named A and B, ZoneList will remember them, but if I add three more zones named C, D, E and re-run my event, ZoneList will be updated to remember all five zones, but saving the project, closing it, and re-opening it will revert ZoneList’s values to A and B only. The only way I’ve found to permanently retain the correct values once I change something is by deleting the object that contains this event, adding a new one, and calling the event once. This isn’t a good workflow at all, and I’m very hesitant to trust a core element of my game’s logic to a function that can’t consistently get and retain the right values; is there an obvious way I can make my actor’s ZoneList retain the correct data between editor sessions?