Help : Enemy aren't resetting

I killed all the enemies in the first scene and go to the second scene
when I go back to the first scene all the enemy is alive but repeatedly play
attack animation. when I kill them they will stop moving but the attack animation still there.

But It works well if I start at the first scene and kill them, just when I go back to the first scene from the second scene the bug appears.

How do I fix this?

I don’t have any idea on how to reset the enemy back if I go back to the first scene.

Have you implemented the save system yet? If that’s the case there’s probably a bug there, check the code or copy paste it here to see if we can help you.

If not, then it sounds like an animator issue, check the enemies’ animator an see where it starts when you reload the scene, there’s probably something weird going on there.

1 Like

Thanks for the response!
I haven’t yet implemented the save system yet.
I’ll come back later after I finished it!

Thanks! :grinning:

Yes, this will make much more sense once you implement the saving system, which is what will be responsible for keeping track of the state of the enemies between scenes.

Still, there’s a bug,

here’s a brief video about the bug.

here’s the script:

I’ve already implemented the restored health system.

In order for the saving system to work, the components that you want information saved have to implement the ISaveable interface.

These components will then have to have a CaptureState() and RestoreState()
Then in Portal, before the LoadSceneAsync, you have to SavingWrapper.Save(), and after the LoadSceneAsync, you SavingWrapper.Load() and SavingWrapper.Save() once again

From what I can see, none of these things are implemented in Health or Portal, so your characters will be alive when the scene is restored.

I have no explanation for the wierd fighting behavior on the scene transition. I would need to see the project itself, to see the scripts in context.

Thanks for the reply,
I’ve manage to get it work.

But I’ve some question about

action scheduler.

My - Question :

My answer for this is on the linked topic.

This topic was automatically closed after 22 hours. New replies are no longer allowed.

Privacy & Terms