How can I get the value from other scene?

I have to make a retry function.I make a value in main menu to save which scene the player is playing. But i have no idea how to get the value in the main menu and use this value to detect which scene is the player lose.

I think you want DontDestroyOnLoad?

Here you go!

you can try playerprefs link text or u can create a static var int and store the current level number(when the player lose) in it and then check it in the main menu .