Hello! I’m making a feature in a game that records the maximum height the player has traveled and displays it. I have it all down except the recording of the maximum height, as right now all it does is record the current height. Help?
public float moneyAmount;
public float heightAmount;
public float maxHeight;
//ignore these below
public float speed;
public float jumpSpeed;
public KeyCode jumpKey = KeyCode.Space;
public KeyCode walkRightKey = KeyCode.D;
public KeyCode walkLeftKey = KeyCode.A;
public Transform playerTransform;
RaycastHit2D hit;
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
heightAmount = playerTransform.position.y;
maxHeight = Mathf.Max(heightAmount);