UnityEngine.Input.GetKeyDown(UnityEngine.KeyCode)

Here are the examples of the csharp api class UnityEngine.Input.GetKeyDown(UnityEngine.KeyCode) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

200 Examples 7

1. Example

Project: Blog
Source File: KeywordManager.cs
private void ProcessKeyBindings()
        {
            foreach (var kvp in KeywordsAndResponses)
            {
                if (Input.GetKeyDown(kvp.KeyCode))
                {
                    kvp.Response.Invoke();
                    return;
                }
            }
        }

2. Example

Project: HoloViveObserver
Source File: KeywordManager.cs
private void ProcessKeyBindings()
        {
            foreach (var kvp in KeywordsAndResponses)
            {
                if (Input.GetKeyDown(kvp.KeyCode))
                {
                    kvp.Response.Invoke();
                    return;
                }
            }
        }

3. Example

Project: Blog
Source File: KeywordManager.cs
private void ProcessKeyBindings()
        {
            foreach (var kvp in KeywordsAndResponses)
            {
                if (Input.GetKeyDown(kvp.KeyCode))
                {
                    kvp.Response.Invoke();
                    return;
                }
            }
        }

4. Example

Project: Blog
Source File: KeywordManager.cs
private void ProcessKeyBindings()
        {
            foreach (var kvp in KeywordsAndResponses)
            {
                if (Input.GetKeyDown(kvp.KeyCode))
                {
                    kvp.Response.Invoke();
                    return;
                }
            }
        }

5. Example

Project: Blog
Source File: KeywordManager.cs
private void ProcessKeyBindings()
        {
            foreach (var kvp in KeywordsAndResponses)
            {
                if (Input.GetKeyDown(kvp.KeyCode))
                {
                    kvp.Response.Invoke();
                    return;
                }
            }
        }

6. Example

Project: Blog
Source File: KeywordManager.cs
private void ProcessKeyBindings()
        {
            foreach (var kvp in KeywordsAndResponses)
            {
                if (Input.GetKeyDown(kvp.KeyCode))
                {
                    kvp.Response.Invoke();
                    return;
                }
            }
        }

7. Example

Project: Blog
Source File: KeywordManager.cs
private void ProcessKeyBindings()
        {
            foreach (var kvp in KeywordsAndResponses)
            {
                if (Input.GetKeyDown(kvp.KeyCode))
                {
                    kvp.Response.Invoke();
                    return;
                }
            }
        }

8. Example

Project: Blog
Source File: KeywordManager.cs
private void ProcessKeyBindings()
        {
            foreach (var kvp in KeywordsAndResponses)
            {
                if (Input.GetKeyDown(kvp.KeyCode))
                {
                    kvp.Response.Invoke();
                    return;
                }
            }
        }

9. Example

Project: Blog
Source File: KeywordManager.cs
private void ProcessKeyBindings()
        {
            foreach (var kvp in KeywordsAndResponses)
            {
                if (Input.GetKeyDown(kvp.KeyCode))
                {
                    kvp.Response.Invoke();
                    return;
                }
            }
        }

10. Example

Project: Blog
Source File: KeywordManager.cs
private void ProcessKeyBindings()
        {
            foreach (var kvp in KeywordsAndResponses)
            {
                if (Input.GetKeyDown(kvp.KeyCode))
                {
                    kvp.Response.Invoke();
                    return;
                }
            }
        }

11. Example

Project: Blog
Source File: InputSourceKeyboard.cs
public static bool GetKeyDown(KeyCode keyCode)
	{
		return Input.GetKeyDown(keyCode);
	}

12. Example

Project: Blog
Source File: Sequencer.cs
public void FixedUpdate()
        {
            if (Input.GetKeyDown(SkipStepButton))
            {

            }

            if (Input.GetKeyDown(RepeatStepButton))
            {

            }

            if (Input.GetKeyDown(ResetButton))
            {

            }
        }

13. Example

Project: Blog
Source File: KeywordManager.cs
private void ProcessKeyBindings()
        {
            foreach (var kvp in KeywordsAndResponses)
            {
                if (Input.GetKeyDown(kvp.KeyCode))
                {
                    kvp.Response.Invoke();
                    return;
                }
            }
        }

14. Example

Project: Blog
Source File: InputSourceKeyboard.cs
public static bool GetKeyDown(KeyCode keyCode)
	{
		return Input.GetKeyDown(keyCode);
	}

15. Example

Project: Blog
Source File: Sequencer.cs
public void FixedUpdate()
        {
            if (Input.GetKeyDown(SkipStepButton))
            {

            }

            if (Input.GetKeyDown(RepeatStepButton))
            {

            }

            if (Input.GetKeyDown(ResetButton))
            {

            }
        }

16. Example

Project: Illusion-Plugins
Source File: OVRCrosshair.cs
bool ShouldDisplayCrosshair()
	{	
		if(Input.GetKeyDown (CrosshairKey))
		{
			if(DisplayCrosshair == false)
			{
				DisplayCrosshair = true;
				
				// Always initialize screen location of cursor to center
				XL = ScreenWidth * 0.5f;
				YL = ScreenHeight * 0.5f;
			}
			else
				DisplayCrosshair = false;
		}
					
		return DisplayCrosshair;
	}

17. Example

Project: Illusion-Plugins
Source File: OVRMainMenu.cs
void UpdateRecenterPose()
	{
		if(Input.GetKeyDown(KeyCode.R))
		{
			OVRManager.display.RecenterPose();
		}
	}

18. Example

Project: Illusion-Plugins
Source File: OVRMainMenu.cs
void UpdateVisionMode()
	{
		if (Input.GetKeyDown(KeyCode.F2))
		{
			VisionMode = !VisionMode;
			OVRManager.tracker.isEnabled = VisionMode;

#if SHOW_DK2_VARIABLES
			strVisionMode = VisionMode ? "Vision Enabled: ON" : "Vision Enabled: OFF";
#endif
		}
	}

19. Example

Project: Illusion-Plugins
Source File: OVRMainMenu.cs
bool ShowLevels()
	{
		if (Scenes.Length == 0)
		{
			ScenesVisible = false;
			return ScenesVisible;
		}
		
		bool curStartDown = OVRGamepadController.GPC_GetButton(OVRGamepadController.Button.Start);
		bool startPressed = (curStartDown && !PrevStartDown) || Input.GetKeyDown(KeyCode.RightShift);
		PrevStartDown = curStartDown;
		
		if (startPressed)
		{
			ScenesVisible = !ScenesVisible;
		}
		
		return ScenesVisible;
	}

20. Example

Project: Illusion-Plugins
Source File: OVRMainMenu.cs
int GetCurrentLevel()
	{
		bool curHatDown = false;
		if(OVRGamepadController.GPC_GetButton(OVRGamepadController.Button.Down) == true)
			curHatDown = true;
		
		bool curHatUp = false;
		if(OVRGamepadController.GPC_GetButton(OVRGamepadController.Button.Down) == true)
			curHatUp = true;
		
		if((PrevHatDown == false) && (curHatDown == true) ||
			Input.GetKeyDown(KeyCode.DownArrow))
		{
			CurrentLevel = (CurrentLevel + 1) % SceneNames.Length;	
		}
		else if((PrevHatUp == false) && (curHatUp == true) ||
			Input.GetKeyDown(KeyCode.UpArrow))
		{
			CurrentLevel--;	
			if(CurrentLevel < 0)
				CurrentLevel = SceneNames.Length - 1;
		}
					
		PrevHatDown = curHatDown;
		PrevHatUp = curHatUp;
		
		return CurrentLevel;
	}

21. Example

Project: Illusion-Plugins
Source File: OVRCrosshair.cs
bool ShouldDisplayCrosshair()
	{	
		if(Input.GetKeyDown (CrosshairKey))
		{
			if(DisplayCrosshair == false)
			{
				DisplayCrosshair = true;
				
				// Always initialize screen location of cursor to center
				XL = ScreenWidth * 0.5f;
				YL = ScreenHeight * 0.5f;
			}
			else
				DisplayCrosshair = false;
		}
					
		return DisplayCrosshair;
	}

22. Example

Project: Illusion-Plugins
Source File: OVRMainMenu.cs
void UpdateRecenterPose()
	{
		if(Input.GetKeyDown(KeyCode.R))
		{
			OVRManager.display.RecenterPose();
		}
	}

23. Example

Project: Illusion-Plugins
Source File: OVRMainMenu.cs
void UpdateVisionMode()
	{
		if (Input.GetKeyDown(KeyCode.F2))
		{
			VisionMode = !VisionMode;
			OVRManager.tracker.isEnabled = VisionMode;

#if SHOW_DK2_VARIABLES
			strVisionMode = VisionMode ? "Vision Enabled: ON" : "Vision Enabled: OFF";
#endif
		}
	}

24. Example

Project: Illusion-Plugins
Source File: OVRMainMenu.cs
bool ShowLevels()
	{
		if (Scenes.Length == 0)
		{
			ScenesVisible = false;
			return ScenesVisible;
		}
		
		bool curStartDown = OVRGamepadController.GPC_GetButton(OVRGamepadController.Button.Start);
		bool startPressed = (curStartDown && !PrevStartDown) || Input.GetKeyDown(KeyCode.RightShift);
		PrevStartDown = curStartDown;
		
		if (startPressed)
		{
			ScenesVisible = !ScenesVisible;
		}
		
		return ScenesVisible;
	}

25. Example

Project: Illusion-Plugins
Source File: OVRMainMenu.cs
int GetCurrentLevel()
	{
		bool curHatDown = false;
		if(OVRGamepadController.GPC_GetButton(OVRGamepadController.Button.Down) == true)
			curHatDown = true;
		
		bool curHatUp = false;
		if(OVRGamepadController.GPC_GetButton(OVRGamepadController.Button.Down) == true)
			curHatUp = true;
		
		if((PrevHatDown == false) && (curHatDown == true) ||
			Input.GetKeyDown(KeyCode.DownArrow))
		{
			CurrentLevel = (CurrentLevel + 1) % SceneNames.Length;	
		}
		else if((PrevHatUp == false) && (curHatUp == true) ||
			Input.GetKeyDown(KeyCode.UpArrow))
		{
			CurrentLevel--;	
			if(CurrentLevel < 0)
				CurrentLevel = SceneNames.Length - 1;
		}
					
		PrevHatDown = curHatDown;
		PrevHatUp = curHatUp;
		
		return CurrentLevel;
	}

26. Example

Project: Memoria
Source File: Input.cs
public static Boolean GetKeyDown(KeyCode keyName)
        {
            return UnityEngine.Input.GetKeyDown(keyName);
        }

27. Example

Project: CubeWorld
Source File: GUIStatePlayerInventory.cs
public override void ProcessKeys()
    {
        if (Input.GetKeyDown(KeyCode.B))
            playerGUI.ExitInventory();
    }

28. Example

Project: CubeWorld
Source File: GUIStatePlayerNormal.cs
public override void ProcessKeys()
    {
        for (int i = (int)KeyCode.Alpha1; i <= (int)KeyC/n ..... /n //View Source file for more details /n }

29. Example

Project: ModAPI
Source File: ConsoleComponent.cs
void Update()
        {
            if (UnityEngine.Input.GetKeyDown(KeyCode.BackQuote) || UnityEngine.Input.GetKeyDown(KeyCode.Backslash))
            {
                ModAPI.Console.Switch();
            }
        }

30. Example

Project: Yugioh-For-HoloLens
Source File: KeywordManager.cs
private void ProcessKeyBindings()
        {
            foreach (var kvp in KeywordsAndResponses)
            {
                if (Input.GetKeyDown(kvp.KeyCode))
                {
                    kvp.Response.Invoke();
                    return;
                }
            }
        }

31. Example

Project: UWO
Source File: TestController.cs
void ChangeMode()
	{
		if (Input.GetKeyDown(KeyCode.Keypad1) || Input.GetKeyDown(KeyCode.Alpha1)) {
			fireMode = FireMode.FireBullet;
		}
		if (Input.GetKeyDown(KeyCode.Keypad2) || Input.GetKeyDown(KeyCode.Alpha2)) {
			fireMode = FireMode.CreateBlock;
		}
		if (Input.GetKeyDown(KeyCode.Keypad3) || Input.GetKeyDown(KeyCode.Alpha3)) {
			fireMode = FireMode.DeleteBlock;
		}
		if (Input.GetKeyDown(KeyCode.Keypad4) || Input.GetKeyDown(KeyCode.Alpha4)) {
			fireMode = FireMode.ChangeBlockColor;
		}

		switch (fireMode) {
			case FireMode.FireBullet: 
				GlobalGUI.SetTool("BULLET");
				break;
			case FireMode.CreateBlock: 
				GlobalGUI.SetTool("+BLOCK");
				break;
			case FireMode.DeleteBlock: 
				GlobalGUI.SetTool("-BLOCK");
				break;
			case FireMode.ChangeBlockColor:
				GlobalGUI.SetTool("COLOR");
				break;
		}
	}

32. Example

Project: UWO
Source File: ToggleLight.cs
void Update() 
	{
		if (Input.GetKeyDown(key) && !GlobalState.isInputting) {
			light.enabled = !light.enabled;
		}
	}

33. Example

Project: StereoAR-for-Unity
Source File: OVRCrosshair.cs
bool ShouldDisplayCrosshair()
	{	
		if(Input.GetKeyDown (KeyCode.C))
		{
			if(DisplayCrosshair == false)
			{
				DisplayCrosshair = true;
				
				// Always initialize screen location of cursor to center
				XL = ScreenWidth * 0.5f;
				YL = ScreenHeight * 0.5f;
			}
			else
				DisplayCrosshair = false;
		}
					
		return DisplayCrosshair;
	}

34. Example

Project: StereoAR-for-Unity
Source File: OVRMainMenu.cs
void UpdateDistortionCoefs()
	{
	 	float Dk0 = 0.0f;
		float Dk1 = 0.0f;
		float Dk2 = 0.0f;
		float Dk3 = 0.0f;
		
		// * * * * * * * * *
		// Get the distortion coefficients to apply to shader
		CameraController.GetDistortionCoefs(ref Dk0, ref Dk1, ref Dk2, ref Dk3);
		
		if(Input.GetKeyDown(KeyCode.Alpha1))
			Dk1 -= DistKIncrement;
		else if (Input.GetKeyDown(KeyCode.Alpha2))
			Dk1 += DistKIncrement;
			
		if(Input.GetKeyDown(KeyCode.Alpha3))
			Dk2 -= DistKIncrement;
		else if (Input.GetKeyDown(KeyCode.Alpha4))
			Dk2 += DistKIncrement;
		
		CameraController.SetDistortionCoefs(Dk0, Dk1, Dk2, Dk3);
		
		//if(ShowVRVars == true)// limit gc
		//	strDistortion = 
		//	System.String.Format ("DST k1: {0:F3} k2 {1:F3}", Dk1, Dk2);
	}

35. Example

Project: StereoAR-for-Unity
Source File: OVRMainMenu.cs
bool ShowLevels()
	{
		if(Scenes.Length == 0)
		{
			ScenesVisible = false;
			return ScenesVisible;
		}
		
		bool curStartDown = false;
		if(OVRGamepadController.GPC_GetButton((int)OVRGamepadController.Button.Start) == true)
			curStartDown = true;
		
		if((PrevStartDown == false) && (curStartDown == true) ||
			Input.GetKeyDown(KeyCode.RightShift) )
		{
			if(ScenesVisible == true) 
				ScenesVisible = false;
			else 
				ScenesVisible = true;
		}
		
		PrevStartDown = curStartDown;
		
		return ScenesVisible;
	}

36. Example

Project: StereoAR-for-Unity
Source File: OVRMainMenu.cs
int GetCurrentLevel()
	{
		bool curHatDown = false;
		if(OVRGamepadController.GPC_GetButton((int)OVRGamepadController.Button.Down) == true)
			curHatDown = true;
		
		bool curHatUp = false;
		if(OVRGamepadController.GPC_GetButton((int)OVRGamepadController.Button.Down) == true)
			curHatUp = true;
		
		if((PrevHatDown == false) && (curHatDown == true) ||
			Input.GetKeyDown(KeyCode.DownArrow))
		{
			CurrentLevel = (CurrentLevel + 1) % SceneNames.Length;	
		}
		else if((PrevHatUp == false) && (curHatUp == true) ||
			Input.GetKeyDown(KeyCode.UpArrow))
		{
			CurrentLevel--;	
			if(CurrentLevel < 0)
				CurrentLevel = SceneNames.Length - 1;
		}
					
		PrevHatDown = curHatDown;
		PrevHatUp = curHatUp;
		
		return CurrentLevel;
	}

37. Example

Project: StereoAR-for-Unity
Source File: OVRMainMenu.cs
void UpdateResetOrientation()
	{
		if( ((ScenesVisible == false) && 
			 (OVRGamepadController.GPC_GetButton((int)OVRGamepadController.Button.Down) == true)) ||
			(Input.GetKeyDown(KeyCode.B) == true) )
		{
			OVRDevice.ResetOrientation(0);
		}
	}

38. Example

Project: uREPL
Source File: Key.cs
public static bool Enter()
	{
		return Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter);
	}

39. Example

Project: uREPL
Source File: KeyBinding.cs
private void ToggleWindowByKeys()
	{
		if (openKey == closeKey) {
			if (Input.GetKeyDown(openKey)) {
				if (!window_.isOpen) window_.Open();
				else window_.Close();
			}
		} else {
			if (Input.GetKeyDown(openKey)) window_.Open();
			if (Input.GetKeyDown(closeKey)) window_.Close();
		}
	}

40. Example

Project: unite-12
Source File: Exploder.cs
void Update () {
	    if (Input.GetKeyDown(KeyCode.Space)) {
	        WallController.Explode();
	    }
	}

41. Example

Project: MolecularRift
Source File: OVRCrosshair.cs
bool ShouldDisplayCrosshair()
	{	
		if(Input.GetKeyDown (CrosshairKey))
		{
			if(DisplayCrosshair == false)
			{
				DisplayCrosshair = true;
				
				// Always initialize screen location of cursor to center
				XL = ScreenWidth * 0.5f;
				YL = ScreenHeight * 0.5f;
			}
			else
				DisplayCrosshair = false;
		}
					
		return DisplayCrosshair;
	}

42. Example

Project: MolecularRift
Source File: OVRMainMenu.cs
void UpdateRecenterPose ()
	{
		if (Input.GetKeyDown (KeyCode.R)) {
			OVRManager.display.RecenterPose ();
		}
	}

43. Example

Project: MolecularRift
Source File: OVRMainMenu.cs
void UpdateVisionMode ()
	{
		if (Input.GetKeyDown (KeyCode.F2)) {
			VisionMode = !VisionMode;
			OVRManager.tracker.isEnabled = VisionMode;

#if SHOW_DK2_VARIABLES
			strVisionMode = VisionMode ? "Vision Enabled: ON" : "Vision Enabled: OFF";
#endif
		}
	}

44. Example

Project: MolecularRift
Source File: OVRMainMenu.cs
bool ShowLevels ()
	{
		if (Scenes.Length == 0) {
			ScenesVisible = false;
			return ScenesVisible;
		}
		
		bool curStartDown = OVRGamepadController.GPC_GetButton (OVRGamepadController.Button.Start);
		bool startPressed = (curStartDown && !PrevStartDown) || Input.GetKeyDown (KeyCode.RightShift);
		PrevStartDown = curStartDown;
		
		if (startPressed) {
			ScenesVisible = !ScenesVisible;
		}
		
		return ScenesVisible;
	}

45. Example

Project: MolecularRift
Source File: OVRMainMenu.cs
int GetCurrentLevel ()
	{
		bool curHatDown = false;
		if (OVRGamepadController.GPC_GetButton (OVRGamepadController.Button.Down) == true)
			curHatDown = true;
		
		bool curHatUp = false;
		if (OVRGamepadController.GPC_GetButton (OVRGamepadController.Button.Down) == true)
			curHatUp = true;
		
		if ((PrevHatDown == false) && (curHatDown == true) ||
			Input.GetKeyDown (KeyCode.DownArrow)) {
			CurrentLevel = (CurrentLevel + 1) % SceneNames.Length;	
		} else if ((PrevHatUp == false) && (curHatUp == true) ||
			Input.GetKeyDown (KeyCode.UpArrow)) {
			CurrentLevel--;	
			if (CurrentLevel < 0)
				CurrentLevel = SceneNames.Length - 1;
		}
					
		PrevHatDown = curHatDown;
		PrevHatUp = curHatUp;
		
		return CurrentLevel;
	}

46. Example

Project: MRDesignLabs_Unity
Source File: KeywordManager.cs
private void ProcessKeyBindings()
        {
            foreach (var kvp in KeywordsAndResponses)
            {
                if (Input.GetKeyDown(kvp.KeyCode))
                {
                    kvp.Response.Invoke();
                    return;
                }
            }
        }

47. Example

Project: MRDesignLabs_Unity
Source File: KeywordManager.cs
private void ProcessKeyBindings()
        {
            foreach (var kvp in KeywordsAndResponses)
            {
                if (Input.GetKeyDown(kvp.KeyCode))
                {
                    kvp.Response.Invoke();
                    return;
                }
            }
        }

48. Example

Project: Holographic-Photo-Project
Source File: KeywordManager.cs
private void ProcessKeyBindings()
        {
            foreach (var kvp in KeywordsAndResponses)
            {
                if (Input.GetKeyDown(kvp.KeyCode))
                {
                    kvp.Response.Invoke();
                    return;
                }
            }
        }

49. Example

Project: MixedRealityCompanionKit
Source File: KeywordManager.cs
private void ProcessKeyBindings()
        {
            foreach (var kvp in KeywordsAndResponses)
            {
                if (Input.GetKeyDown(kvp.KeyCode))
                {
                    kvp.Response.Invoke();
                    return;
                }
            }
        }

50. Example

Project: MRDesignLabs_Unity_LunarModule
Source File: KeywordManager.cs
private void ProcessKeyBindings()
        {
            foreach (var kvp in KeywordsAndResponses)
            {
                if (Input.GetKeyDown(kvp.KeyCode))
                {
                    kvp.Response.Invoke();
                    return;
                }
            }
        }