Hello
On my scene I added a destructible component to my enemy AI and my pickup gun.
When loading game after enemy is killed and gun is picked up then the gun is gone but the enemy is still there?
How does it work with that so the enemy is actually gone/dead when loading a saved game?
Cheers
Enemy ai still there after load game
Re: Enemy ai still there after load game
If the enemy GameObject is destroyed or deactivated when the player kills it, add a DestructibleSaver component to it, and set a unique Key value.
Re: Enemy ai still there after load game
That is the component I already have on the AI..
When he dies, he plays the death animation and lies flat on the ground. Then I save my game and when I load again the ai is alive again
When he dies, he plays the death animation and lies flat on the ground. Then I save my game and when I load again the ai is alive again
Re: Enemy ai still there after load game
Does the Destructible Saver have a unique Key?
Are there any errors or warnings in the Console window?
Are there any errors or warnings in the Console window?
Re: Enemy ai still there after load game
Yes , inserted the name BOT in the key field.
On my AI it was set to remove the object after 30 seconds.
I saved my game while he played the death animation.
So that was the issue. Whe i saved the game after the 30 sec when AI was removed, then it works.
On my AI it was set to remove the object after 30 seconds.
I saved my game while he played the death animation.
So that was the issue. Whe i saved the game after the 30 sec when AI was removed, then it works.
Re: Enemy ai still there after load game
If your AI has a UnityEvent that's invoked when it dies, configure the UnityEvent to call DestructibleSaver.RecordDestruction. This way it will record the AI's death right away instead of having to wait 30 seconds.