Skip to content

Instantly share code, notes, and snippets.

@ninpl
Created April 26, 2018 03:15
Show Gist options
  • Select an option

  • Save ninpl/15733c2bf71da825f39a5e1f124efe8b to your computer and use it in GitHub Desktop.

Select an option

Save ninpl/15733c2bf71da825f39a5e1f124efe8b to your computer and use it in GitHub Desktop.
Detectar cualquier tecla o botón presionado. Unity3D.
#region Librerias
using UnityEngine;
using System;
#endregion
namespace MoonAntonio
{
public class UDetectKey : MonoBehaviour
{
private void Update()
{
DeteccionTeclaBtnPresionada();
}
public void DeteccionTeclaBtnPresionada()
{
foreach (KeyCode kcode in Enum.GetValues(typeof(KeyCode)))
{
if (Input.GetKeyDown(kcode)) Debug.Log("KeyCode down: " + kcode);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment