While we all appreciate you rushing in here 11 years later to post this, you really ought to consider taking it down because it sets some absolutely DREADFUL examples, and we already have enough of those floating around.
For one, class player
should be class Player
… that’s just standard C# naming if you want other C# people to be able to read your code easily.
For two, you’re doing non-physics stuff (eg using a CharacterController) and yet you are doing it in FixedUpdate(). This is just not a good thing for a whole host of reasons that you will soon learn about.
Third, you are calling GetComponent() every FixedUpdate() rather than getting it once in Start() and caching it.
Fourth, your grounded check simply compares the enum CollisionFlags.CollidedBelow
(which is a constant) with another constant (zero), so it will always be true… so why have that check at all? Perhaps you left out some code? It kinda all 100% has to be there… that’s how software works!
And finally, the highest sin of all, you have failed to put code formatting tags in, making it an unreadable miasma of proportional font unaligned misindented text.
If you post a code snippet, ALWAYS USE CODE TAGS:
How to use code tags: https://discussions.unity.com/t/481379