Not saving Dead emenies

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
timbecile
Posts: 110
Joined: Mon Mar 12, 2018 11:00 pm

Not saving Dead emenies

Post by timbecile »

Hey Tony,

couldn't find this anywhere...I'm using the Spawned Object Manager to save spawned enemies, but it still spawns them after they are dead. How do I make it so that it won't spawn enemies that are dead? is there a method to remove them from the Spawned Objects list?
User avatar
Tony Li
Posts: 21080
Joined: Thu Jul 18, 2013 1:27 pm

Re: Not saving Dead emenies

Post by Tony Li »

Hi,

Make sure your enemies have a SpawnedObject component. If they are only deactivated, and not destroyed, when killed, change Mode from OnDestroy to OnDisable. When the SpawnedObject component detects that the GameObject has been destroyed or disabled, it will remove itself from the Spawned Object Manager's list.
timbecile
Posts: 110
Joined: Mon Mar 12, 2018 11:00 pm

Re: Not saving Dead emenies

Post by timbecile »

ah, that makes it a bit more difficult, since I want their bodies to hang around while the player is still in the level.

But I think I can detach the model game object from the parent and then destroy the parent.

Thanks Tony!
User avatar
Tony Li
Posts: 21080
Joined: Thu Jul 18, 2013 1:27 pm

Re: Not saving Dead emenies

Post by Tony Li »

Set the mode to Disable. When the NPC dies, just disable the Spawned Object component.
timbecile
Posts: 110
Joined: Mon Mar 12, 2018 11:00 pm

Re: Not saving Dead emenies

Post by timbecile »

ah! that makes much more sense!
Post Reply