Save System - Spawned Enemy

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
CruttMutt
Posts: 41
Joined: Wed May 06, 2020 9:44 am

Save System - Spawned Enemy

Post by CruttMutt »

Hello Tony!

I have a question about the save system.

Everything is fine when I kill an enemy, save and reload. They are disabled until they are scheduled to respawn. The issue is when they actually respawn and I save and load they remain as their disabled state.

The video shows everything I am about to refer too probably clearer than my words:

VIDEO:


I have looked at other posts and tried to implement what had been suggested when it comes to quest objects using the spawned object/spawned object manager. They are UCC characters but do not contain any inventory or anything that needs to be saved besides being disables/enabled. I wondered if I can't have the destructible saver and spawned object on the same prefab but if I don't then it will not save their current state on load.

In short its:
Start Game > Kill Enemy > Save/Load > Enemy is still dead (good) > Enemy respawns > Save/Load > Enemy is still disabled.

I assume I have just tripped over my own feet here somewhere. Hope it's easy enough/clear enough to fix!

Cheers.

PS: Everything else has been working great otherwise!
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save System - Spawned Enemy

Post by Tony Li »

Hi,

If you deactivate the enemy's GameObject when killed and then reactivate it when the enemy respawns, remove the DestructibleSaver and SpawnedObject components. Add an ActiveSaver instead. If the GameObject starts inactive in the scene at design time, you'll need to add ActiveSaver to an active GameObject and point it to the enemy.
CruttMutt
Posts: 41
Joined: Wed May 06, 2020 9:44 am

Re: Save System - Spawned Enemy

Post by CruttMutt »

Perfect every time. You've thought of everything!!

Thanks legend :)
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save System - Spawned Enemy

Post by Tony Li »

Glad I could help!
Post Reply