The question is a little not correct. If you go back to our world, what does the mountain mean too high, that a person stepping on it should slide down? No matter how much a person walks on a mountain, he can walk along it again and again, the height of the mountain will not stop him at all. Rather, it may limit the angle of the mountain if it does not have the appropriate equipment. If you want to restrict your character to travel in the mountains with a certain inclination, then this is already implemented in Unity for you. You must add a Character Controller to your character, and move the character to it, it has a Move method. And he will take care of the whole physics, he has the Slope Limit parameter. I suppose that is what you need.
Unity Manual Character Controller
Character Controller Move
Application.Quit()
) and UI-part (keyboard processing) in one pile. Read about MVC / MVP. - VladD