Variable continuously add up in Update()

Hi All, I’m a newbie.

I’m having a really odd problem here, the filed I defined just continuously add up in Update() function.

This is my code:

using UnityEngine;
using System.Collections;

public class MenuManager : MonoBehaviour {

	private int counter = 0;

	void Update ()
	{
		ShowSelectedMenuItem ();
	}

	private void  ShowSelectedMenuItem() {

		if (Input.GetAxisRaw ("Vertical") > 0.9) {
			
			
		} else if (Input.GetAxisRaw ("Vertical") < - 0.9) {

			Debug.Log("s Down");
			
			counter=counter+1;
			
			Debug.Log (string.Format("counter {0} ",counter));
			Debug.Log("Finish s down");
		
		}
        }	
}

I’m excepting output like these:
s Down
counter 1
Finish s down

However,
In log I got:
s Down
counter 1
Finish s down
counter 2
counter 3
counter 4
counter 5
counter 6
counter 7
counter 8

This is really odd, No matter what I do, I have tried counter++, counter = (counter+1). Makes no different. After the function, counter just keep add up another 7 times but “s Down” and “Finish s down” never showed second time.
This script attached to an empty object in a empty project.
My editor version is 4.5.4

Any help would be appreciated

You have pressed the “collapse” button at the top of your console window. If that button is toggled on the console will collapse / group the same message into one. That’s why you don’t see the other logs, bug they are there.