Mike Geig's Player Controller causes triple jump????

Hi,

Im using Mike’s Player Controller code which was on the Unity Youtube channel. It works fine, i can move and double jump properly.

The only issue is whenever i enter any type of trigger in the level the player can jump multiple times before touching the ground when jump is pressed repeatedly, everywhere else i can single/double jump fine.(Even an empty gameobject + box coliider + IsTrigger ticked causes this)

Why does this happen and how can i prevent is??? PLEASE assist. Thanks

This happens because your trigger is being fired by other gameObjects.
In the Project Space Shooter tutorial, we encounter the same issue, this is solved by using

if (other.tag == "Boundary") {
			return;
		}

where we ignore objects with specific tags.

In your case, tag anything that you wish not to jump off of by selecting the object(s), go to the top of the inspector and click the drop-down next to tag, click Add Tag, name element 0 whatever you wish, select your object again, then click tag-addtag again and select your tag.

Now, using the collision script, where ‘other’ is your collider you are colliding with, execute everything under an if statement such as this:

if (other.tag != "tagnamehere"){execute code here....
}