How to properly load level in UDK?

After decades of thinking and investigating how to change level? Properly i do destroy all actors then load the level but no idea on how to properly do it lol… Any help?

If you want to start a new game on a new level, you use the console command start LevelName?Game=YourGameInfoClass. In code, in your PlayerController, you can put that in ConsoleCommand("start LevelName?Game=YourGameInfoClass");. That will automatically destroy all actors and close all menus for you.

If you have UDK | LevelStreamingHowTo set up, and you want to stream levels into and out of the world, then you could use a UDK | LevelStreamingVolumes. Or you could use a trigger volume and Kismet. Unloading a streaming level will remove any actors that you placed using the editor. Unloading a streaming level does not destroy dynamically created actors. So for example if you stream a level then spawn an enemy pawn inside that level, then unstream the level, then the enemy pawn just falls out of the map. You would have to write your own Kismet sequence action to destroy actors.

To load/unload streaming levels in code, you should use PlayerController.ClientUpdateLevelStreamingStatus. Once again, it does not automatically destroy actors in the level. You will need to write your own code to do that.

In my case, when unloading a stream level, the pawns are automatically destroyed, but not the controllers (because they are spawned from the pawn into the persisintent level, I think).

Also when loading a strean level into the persistent, a garbage collection is performed and that is the main cause of the game freezing. Do you know if there is any way to avoid that garbage collector when stream a level?

I think the only solution for that hitch/pause/freeze when loading or unloading levels is to make the levels smaller. I recently built a very fast new computer, and even on that, level changes still take a second or two.

Perhaps it could be done by editing the source code. I have many streams levels on the map and I have the problem when you are in a place that matches the distance in which the level is loaded and unloaded. When you move the player or the camera, this causes the level to load and unload and makes the game experience horrible.

I had thought of calling a function when loading a level that increases the distance of the level by, for example, 5000 units, and when exiting the level, restores the distance (saved in an array at the start of the game). In this way, you would avoid constant loading and unloading when moving the camera or the player.

And another option would be not to use the streams levels and to create an actor with an array that stores all the actors in a certain radius, that spawns those actors progressively, first the big ones, a few in each tick. And when moving away, destroy them in the same way.
In this way there would be no freeze and the garbage collector could be allowed to act periodically as normal.

Blockquote Perhaps it could be done by editing the source code

Did you say UDK 2? : D