changing the texture on a 2D player if an action occurs

i’m trying to change the texture of my 2D player when he jumps and change it back when he lands (i have only 2 textures 1 for jump and 1 for walk so an animation would be unnecessary) but the problem that i have is that when i play, the object changes the texture but only when i press the jump button. i’m pretty new to unity so any help would be much appriciated.

ps i dont have my original code left i deleted when i gave up thinking it was total garbage

GetButtonDown is true for one frame only, so the texture is switched back immediately. Use another function to reset the texture, such as OnTriggerEnter.

Example:

function OnTriggerEnter(other : Collider) {
    if(other.tag == "Ground") {
        renderer.material.mainTexture = Texture1;
    }
}