Static Variable Problem

I have a static variable of ‘isCrouching’ and a script which allows the player to run:

//Run.js

var character : CharacterController = GetComponent(CharacterController);
	if (!InGameMenu.isPaused) {
		if (Input.GetKey(KeyCode.LeftShift)) {
			Crouch.isCrouching = false;
			character.SimpleMove(transform.TransformDirection (Vector3.forward) * maxSpeed);
			audio.clip = runningSound;
			audio.Play();
			isRunning = true;

isCrouching should be disabled when the running function begins.

//Crouch.js

if (!Run.isRunning && Input.GetKeyDown(KeyCode.C)) {
				isCrouching = !isCrouching;
			if (isCrouching) {
				playerMesh.transform.localScale = Vector3(1, 0.75, 1);
				playerMesh.transform.localPosition = Vector3(0, -0.25, 0);
				mainCam.transform.localPosition = Vector3(0, 0, 0);
				character.height = 1.5;
				character.center = Vector3(0, -0.25, 0);
			}
			if (!isCrouching) {
				playerMesh.transform.localScale = Vector3(1, 1, 1);
				playerMesh.transform.localPosition = Vector3(0, 0, 0);
				mainCam.transform.localPosition = Vector3(0, 0.5, 0);
				character.height = 2;
				character.center = Vector3(0, 0, 0);
			}

isCrouching cannot be activated while ‘isRunning’ is. I have no idea why, but when ‘isRunning’ is activated, ‘isCrouching’ is not deactivated. Any tips?

When the player press LeftShift your code changes the Crouch.isCrouching to false, but it do not execute the script inside “if (!isCrouching)” and won’t do it cause isRunning will be true and it will never enter the “if (!Run.isRunning && Input.GetKeyDown(KeyCode.C))” statement.

So, copy all the content of “if (!isCrouching)” to “if (Input.GetKey(KeyCode.LeftShift))” so it can uncrouch when you start run.