If statement is true even though defined key is not being pressed

I think the title explains itself pretty well. Even though I’m not pressing H, it is still true! I need some help, as I started just a month ago and haven’t been doing much.

using UnityEngine;

public class PlayerCameraController : MonoBehaviour
{
    void Start()
    {
	Camera mycam = GetComponent<Camera>();
    }

    void Update()
    {
Camera mycam = GetComponent<Camera>();
Vector3 target = mycam.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, mycam.nearClipPlane));
transform.LookAt(target, Vector3.up);
if(Input.GetKeyDown(KeyCode.H));
	{
	Debug.Log ("Yep");
	}
    }
}

You have a semicolon right after the if statement. This makes the Debug.Log line always run regardless of the if condition.

3 Likes