ScrollWheel not working in both directions

I have this piece of code,

	void FunctionOne()
	{
		if (Input.GetAxis ("Mouse ScrollWheel") < 0f) 
		{
			animationOne.Play ("animeOneAnimation");
			boolOne = true;
			FunctionTwo ();
		}
	}

	void FunctionTwo()
	{
		if (boolOne == true) 
		{

			StartCoroutine(FunctionThree ());
		}
	}
	
	IEnumerator FunctionThree()
	{
		if (Input.GetAxis ("Mouse ScrollWheel") > 0f) 
		{
			yield return new WaitForSeconds (0.5f);
			animationTwo.Play ("animeTwoAnimation");
			yield return new WaitForSeconds (0.5f);
			boolTwo = true;
			FunctionFour ();
		}
	}

It is not working as is, but if I change the < / > on the two if(Input.GetAxis (“Mouse ScrollWheel”)>0) Statements to the same, as in both being Less Than or both being More Than, it works, but I want it to work with a scroll < 0 and then a scroll > 0, like I have it in the code.
Is there a way I can fix this issue to my liking, I’ve been at this for a day and half and can’t figure it out.
Thanks for any help.

Well, you have a contradiction in your logic. Since you did no provide any description what your code actually should do, which method is initially executed and inside which callback we can just guess. Your method naming also doesn’t help to understand your code.

So i guess you somehow execute “FunctionOne” every frame. When you scroll down you start the coroutine “FunctionThree” inside your “FunctionTwo” method. Your coroutine doesn’t contain a loop so it’s only executed once. However since the coroutine is only started when you scrolled down this frame, the check inside the coroutine to see if you scrolled up is pointless since the coroutine is only executed once and only if we scrolled down this frame. You can’t scroll up and down at the same time. So the code inside the if statement inside your coroutine can never run.

That’s simply the summary / explanation of what happens in your code at the moment. I can’t really suggest any “fixes” since i have no idea what behaviour you would expect. You should start picking meaningful method names which actually reflects the purpose of the method.

If you want to be able to detect if the user scrolls “up” or “down” you have to check both cases every frame.

@Joxerbrown: This can’t work because the second scrollwheel check (the one in FunctionThree) is executed instantly after the first one (even in the same frame). And of course the scrollwheel value can’t be positive and negative in the same frame / at the same time.

What do you actually want to achieve? Do you want to trigger an action when the mousewheel is rotated first in one direction and shortly after that in the other direction? Then you should alter your FunctionThree to something like

float checkStart = Time.time
while (!(Input.GetAxis ("Mouse ScrollWheel") > 0f)) {
    yield return null;
}
if (Time.time - checkStart > 0.5f) {
    //do stuff
}

With 0.5 being the time you have (in seconds) to rotate the mousewheel into the other direction to trigger stuff.

I didn’t test this but it should work that way.
It’s not a perfect solution though because you could start tons of coroutines this way etc. so this definitely needs some more fine tuning.