Thank you @Bqlqzs, that is good advice for creating a prefab of the parent and spawn them again after the player died.
In my scenario is also similar, but it works too. Wanted to point it out and share some ideas.
1. A player touches a checkpoint.
2. After the checkpoint there are some enemies, the player kills all the enemies.
3. After the player kills the enemies, the player falls off a cliff and died.
4. The player gets respawn on the checkpoint and the enemies get respawn too.
5. And for example, if even though the player didn't kill those enemies and falls off a cliff, the player gets respawn on the checkpoint and the enemies too.
The Solution in my scene:1. In the Player FSM, when the player dies do "Set Position 2D" to the checkpoint position. This way is to get respawn the player on the checkpoint.
2. The enemy Game Objects must become Children on a Parent Game Object of enemies. And create a Prefab of the Parent.
3. In the Parent Game Object set an FSM and do "Get Owner" to store a global variable.
4. In the Player FSM, when the Player dies do "Destroy Object" on the stored global variable. This way is to delete the old enemies before the Player dies.
5. In the Player FSM, also add "Create Object" on the Game Object field put the prefab (not the global variable, but simply drag the prefab object from the asset). In the "Create Object" I left everything to None except the Game Object. This way is to get respawn of the new enemies after the Player dies.
Other Possibilities and Questions:I haven't tried to solve them but here are my thoughts, and if there is anyone who can solve them please help to share some advices or answers.
1. What if there are coins you collect after the Player touches the checkpoint, and when the Player dies you need to restart the collected number. So basically, respawn new coins and reset to the numbers before you have collected them when the Player dies.
2. How about XP Points you gain after killing enemies after the checkpoint, and the player dies. And you need to reset the XP Points after you gain, does it work the same as the coins too?
3. Fall Platforms, that's included the previous reply and I think it makes sense too because spawning new objects meaning get reset to the default position.
4. If you have any other possibilities or questions feel free to ask
