Page 1 of 1

Not saving Dead emenies

Posted: Mon Mar 04, 2019 10:36 pm
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?

Re: Not saving Dead emenies

Posted: Tue Mar 05, 2019 9:13 am
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.

Re: Not saving Dead emenies

Posted: Tue Mar 05, 2019 12:21 pm
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!

Re: Not saving Dead emenies

Posted: Tue Mar 05, 2019 12:41 pm
by Tony Li
Set the mode to Disable. When the NPC dies, just disable the Spawned Object component.

Re: Not saving Dead emenies

Posted: Tue Mar 05, 2019 1:50 pm
by timbecile
ah! that makes much more sense!