How to end level after sinking?

I want to make the game end after overlapping the box in the water with an option of restarting. What should I do?

what you should do is really up to you and how you want to implement things. at the most simple you could use a on overlap event then connect it to a open level node and reopen the level you in. Or you could get as complex as you wish and create widgets that pop up with options for the player to choose such as restart level, quit game, and main menu. you also need to consider if there are penalties to dieing in your game such as reducing lives or zeroing a score.

so basically the answer is it depends.

How most games do this is similar to how they tell if you fall out of the map versus die by an enemy. Create a new Damage Type and call it Water or Drowning Damage Type. Set the water to use that damage type. When the player takes damage, run a branch check to see if the damage type == water/drowning. If yes, then they died by water, if no, they did not. You can even do a Switch on the damage type on the AnyDamage function and set a different reaction for each type of damage. Let me know if you need more information.

Learn more about Damage Types, what they do, and how to use them.