Get Key not working

So I’m not sure if this is a bug or compilation issue or what. But I just added an animation to my player model which is controlled by a boolean in Mechanim. Said boolean is changed through the script when the “LeftShift” key is down. If it’s down it returns true, otherwise false. Simple enough, and the transition for the animation between running, idle and walking is based off this bool. The code is simple within my update in C sharp.

if (Input.GetKeyDown(KeyCode.LeftShift))
        {
            Debug.Log("We're Running");
            AliAnimations.SetBool("Running", true);
        }
        else
        {
            Debug.Log("We're NOT Running");
            AliAnimations.SetBool("Running", false);
        }

But for some reason this acts like it’s only working once as if it’s a single frame rather than a constant update despite being in the update function. Meaning, as soon as I hit play it will say “We’re NOT Running” as it’s supposed to, but only once. Then when I press my key it does the running one only once as well and doesn’t transition anymore after that. Am I missing something simple? Or is this some kind of odd bug or issue with the update? Or am I just plain derp and not thinking clearly right meow?

No bug or anything. Read the docs for GetKeyDown: “Returns true during the frame the user starts pressing down the key”.

–Eric

To elaborate and be more direct: You’re looking for : Input.GetKey

Yeah I changed that to get key rather than key down. Still had the same issue. I found out what was wrong, and it wasn’t the code. When I exported my animation for my character I forgot that I changed both the idle and walking animations scale to .7 in the editor and didn’t do the same to the running animation. And for some reason, if that’s not the same scale the whole thing goes wack.

The GetKeyDown that I had was just something I forgot to change when I tried doing KeyDown and KeyUp attempts to see if those work, but they didn’t either. It wasn’t until I changed the import settings of my model that it started working. Kinda odd. Either way, I got it working.

Hmmm. Just as a note, I tried recreating the same results with exactly the same code I had before and a re-import and it wasn’t the scaling. It is something with how my model is exporting or importing. But I’m not sure what. I got my animation working, but some reason on the initial export/import from 3ds Max they don’t work. It’s not till I play with the settings that they start working. And it’s not consistent either. It must be my Max or how I’m doing it.