What is the current situation on loading and unloading levels?

#1

Hey,

what is the current situation on loading and unloading levels? Is there a System for it? And how can you define levels in data files? Like say I have a level that consists of a set of entities, (1) how do I define that level at all so so can load it with a few lines of code? And (2) how do I define that level reducing redundancy? Like say I would like to spawn the same kind of enemy a few times at different locations, but I obviously don’t want to define it’s components multiple times, but rather want to name the enemy once, and then spawn that entity multiple times just modifying its location.

(Théo Degioanni) #2

I believe the best way to achieve that right now would be to use prefabs. For example, you could have a level prefab. If you want to have an enemy spawner for example, you could have an enemy prefab that you instantiate on a regular basis.

1 Like
(Joël Lupien) #3

What moxi said is good. In addition, I usually add the Removal component on the prefab parent entity. Then, when I want to unload the level, I just execute the exec_removal function with the level’s id.

2 Likes