Hi Toni
If I play game from the actual level and die then it will restart and work as intended.
But when I start game from main menu and then when I die, game don’t restart. It just continues with my player dead on the ground
Invector restart after death not working
Re: Invector restart after death not working
No I did not.
So I basically create a script and add this to it.
Nice and easy.
As I understand it will respawn from the saved game I loaded from?
If for some reason there is no saved game I need to put some code in the “else” statement.
Sorry Toni I am not that good with code, do you have an example how to display the menu/ load ?
Like you suggest in the comments
Cheers
So I basically create a script and add this to it.
Nice and easy.
As I understand it will respawn from the saved game I loaded from?
If for some reason there is no saved game I need to put some code in the “else” statement.
Sorry Toni I am not that good with code, do you have an example how to display the menu/ load ?
Like you suggest in the comments
Cheers
Re: Invector restart after death not working
It works.
But it restarts ASAP..
Can i delay 2 sec so i can see the death animation?
But it restarts ASAP..
Can i delay 2 sec so i can see the death animation?
Re: Invector restart after death not working
Yes, you can modify the ReloadOnDeath method to do that. Maybe something like:
Code: Select all
private void ReloadOnDeath(GameObject player)
{
if (SaveSystem.HasSavedGameInSlot(checkpointSaveSlot))
{
Invoke(nameof(LoadCheckpoint), 2); // Load from checkpoint after 2 seconds.
}
else
{
// Show load game menu? Go to main menu? etc. (Add your code)
}
}
private void LoadCheckpoint()
{
SaveSystem.LoadFromSlot(checkpointSaveSlot);
}
Re: Invector restart after death not working
It worked.
You are truely awesome Toni..
Cheers
You are truely awesome Toni..
Cheers
Re: Invector restart after death not working
Glad to help!