how to make your character run when you hold shift and w key?

Hello everyone. I’m still new in programming and Unity. Currently, i am developing game look like Resident Evil Remastered HD that release recently. I use Maximo’s Basic locomotion script and animator for my character, which does not include run animation. I really want my game have the similar control scheme like Resident Evil classic.

My question is how to modify the Maximo script and add the shift key as a trigger for running? Please help me.

This is a script I use and made for the movement of my player. It allows me to walk up and down, turn, and run.

using UnityEngine;

public class Movement : MonoBehaviour
	public float Speed;
	public float RunSpeed;
	public float NormalSpeed;
	public bool isRunning = false;

	void Update() {
		var x = Input.GetAxis("Horizontal") * Time.deltaTime * 150.0f;
		var z = Input.GetAxis("Vertical") * Time.deltaTime * Speed;

		transform.Rotate(0, x, 0);
		transform.Translate(0, 0, z);

		if (Input.GetKey(KeyCode.W) && Input.GetKey(KeyCode.LeftShift)) {

			isRunning = true;
			Speed = RunSpeed;
			print ("Running");

		} else {

			isRunning = false;
			Speed = NormalSpeed;
			print ("Not Running");


You should first identify the part of the script that is launching the walk animation and then if you don’t figure how it works try to learn that before going further :stuck_out_tongue:
Scripting is the key to any project you’ll have so go learn first.
hint: it must be an event in OnGUI()

You want your character to run yet do not seem to have set up any parameters to tell the engine when to switch the running animation on/off.

For a start the Unity Standard Assets comes with a FPS controller (and script) that provides the functions you are looking for (running when shift is held down) which you could dissect to fine the code you need.

You appear to have a “moved” parameter (is this your running parameter?) you should use better names like IsWalking, IsIdle, IsRunning.

Either way you need a parameter that deals with running (I suggest IsRunning)

void Awake(){
public bool IsRunning = false;
anim.SetBool ("IsRunning", IsRunning);

void Running(){
IsRunning = true;
anim.SetBool ("IsRunning", IsRunning);

void StopRunning(){
    IsRunning = false;
    anim.SetBool ("IsRunning", IsRunning);

Call the Running() function if the user is pressing W and Shift and StopRunning() when they let go of the shift key.

There are multiple ways to get the same result so it depends how you want to handle the process.