当前位置: 首页 > news >正文

【Unity3D编辑器开发】Unity3D中制作一个可以随时查看键盘对应KeyCode值面板,方便开发

推荐阅读

  • CSDN主页
  • GitHub开源地址
  • Unity3D插件分享
  • 简书地址
  • 我的个人博客

大家好,我是佛系工程师☆恬静的小魔龙☆,不定时更新Unity开发技巧,觉得有用记得一键三连哦。

一、前言

在开发中,会遇到要使用监控键盘输入的KeyCode值来执行代码的情况。

比如说:

using System;
using UnityEditor;
using UnityEngine;public class Test01 : MonoBehaviour
{void Update(){if (Input.GetKeyDown(KeyCode.W)){Debug.Log("点击了键盘W");}}
}

但是,如果是一些不常用的键位,比如说{}[],这些KeyCode值就比较难查看了,因为API是这样的:
在这里插入图片描述
根本不知道这英文还是数字代表了啥,于是就诞生了,在Unity做一个键盘,然后在键盘的键位下标注每个键位的KeyCode值,方便开发。

先看下效果图:
在这里插入图片描述

小明:键位没有对齐,逼死强迫症啊喂!
张三:不重要!不重要!

二、正文

2-1、构建键盘键值表

让我们新建一个脚本,命名为VirtualKeyboardEditor.cs名字无所谓,主要是要继承与EditorWindow类,并且把脚本放到Editor文件夹内。

编辑代码:

using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;public class VirtualKeyboardEditor : EditorWindow
{[MenuItem("工具/键盘映射值")]static void OpenWindow(){GetWindow<VirtualKeyboardEditor>().Show();}//用于绘制窗口内容private void OnGUI(){}
}

然后,我们需要写一个自定义类,用来保存键盘值名和KeyCode值,以及长宽。

// 键盘映射value值
public class VirKeyValue
{public float height;public float width;public string name;public string key;public VirKeyValue(string name, string key, float width, float height){this.name = name;this.width = width;this.height = height;this.key = key;}
}

接着构建键值库:

static Dictionary<int, List<VirKeyValue>> dicVirKeys;const int width1 = 50;const int width2 = 80;const int width100 = 100;const int width120 = 120;const int width140 = 138;const int width3 = 300;const int height1 = 30;private void DataInit(){if (dicVirKeys == null){dicVirKeys = new Dictionary<int, List<VirKeyValue>>();List<VirKeyValue> tempVirKeys = new List<VirKeyValue>{new VirKeyValue("Esc","Esc", width1, height1),new VirKeyValue("F1","F1", width1, height1),new VirKeyValue("F2","F2", width1, height1),new VirKeyValue("F3","F3", width1, height1),new VirKeyValue("F4","F4", width1, height1),new VirKeyValue("F5","F5", width1, height1),new VirKeyValue("F6","F6", width1, height1),new VirKeyValue("F7","F7", width1, height1),new VirKeyValue("F8","F8", width1, height1),new VirKeyValue("F9","F9", width1, height1),new VirKeyValue("F10","F10", width1, height1),new VirKeyValue("F11","F11", width1, height1),new VirKeyValue("F12","F12", width1, height1),new VirKeyValue("Print\nScreen","Print", width1, height1),new VirKeyValue("Scroll\nLock", "ScrollLockScroll",width1, height1),new VirKeyValue("Pause","Pause", width1, height1)};dicVirKeys.Add(0, tempVirKeys);tempVirKeys = new List<VirKeyValue>{new VirKeyValue("~\n`","BackQuote", width1, height1),new VirKeyValue("!\n1","Alpha1", width1, height1),new VirKeyValue("@\n2","Alpha2", width1, height1),new VirKeyValue("#\n3","Alpha3", width1, height1),new VirKeyValue("$\n4","Alpha4", width1, height1),new VirKeyValue("%\n5","Alpha5", width1, height1),new VirKeyValue("^\n6","Alpha6", width1, height1),new VirKeyValue("&\n7","Alpha7", width1, height1),new VirKeyValue("*\n8","Alpha8", width1, height1),new VirKeyValue("(\n9","Alpha9", width1, height1),new VirKeyValue(")\n0","Alpha0", width1, height1),new VirKeyValue("_\n-","Minus", width1, height1),new VirKeyValue("+\n=","Equals", width1, height1),new VirKeyValue("←Backspace","Backspace", width120, height1),new VirKeyValue("Insert","Insert", width1, height1),new VirKeyValue("Home", "Home",width1, height1),new VirKeyValue("Page\nUp", "PageUp",width1, height1),new VirKeyValue("NumLk","Numlock", width1, height1),new VirKeyValue("/","KeypadDivide", width1, height1),new VirKeyValue("*","KeypadMultiply", width1, height1),new VirKeyValue("-","KeypadMinus", width1, height1),};dicVirKeys.Add(1, tempVirKeys);tempVirKeys = new List<VirKeyValue>{new VirKeyValue("Tab","Tab", width100, height1),new VirKeyValue("Q","Q",width1, height1),new VirKeyValue("W","W",width1, height1),new VirKeyValue("E","E",width1, height1),new VirKeyValue("R","R",width1, height1),new VirKeyValue("T","T",width1, height1),new VirKeyValue("Y","Y",width1, height1),new VirKeyValue("U","U",width1, height1),new VirKeyValue("I","I",width1, height1),new VirKeyValue("O","O",width1, height1),new VirKeyValue("P","P",width1, height1),new VirKeyValue("{\n[","LeftBracket", width1, height1),new VirKeyValue("}\n]","RightBracket", width1, height1),new VirKeyValue("|\n\\", "Backslash",70, height1),new VirKeyValue("Delete", "Delete",width1, height1),new VirKeyValue("End", "End",width1, height1),new VirKeyValue("Page\nDown","PageDown", width1, height1),new VirKeyValue("7","Keypad7",width1, height1),new VirKeyValue("8","Keypad8",width1, height1),new VirKeyValue("9","Keypad9",width1, height1),new VirKeyValue("+","KeypadPlus",width1, height1),};dicVirKeys.Add(2, tempVirKeys);tempVirKeys = new List<VirKeyValue>{new VirKeyValue("Caps\nLock","Backspace", width120, height1),new VirKeyValue("A","A", width1, height1),new VirKeyValue("S","S", width1, height1),new VirKeyValue("D","D", width1, height1),new VirKeyValue("F","F", width1, height1),new VirKeyValue("G","G", width1, height1),new VirKeyValue("H","H", width1, height1),new VirKeyValue("J","J", width1, height1),new VirKeyValue("K","K", width1, height1),new VirKeyValue("L","L", width1, height1),new VirKeyValue(":\n;","Semicolon", width1, height1),new VirKeyValue("\"\n'","Quote", width1, height1),new VirKeyValue("Enter","Enter", 104, height1),new VirKeyValue("4","Keypad4",width1, height1),new VirKeyValue("5","Keypad5",width1, height1),new VirKeyValue("6","Keypad6",width1, height1),new VirKeyValue("Enter","KeypadEnter", width1, height1),};dicVirKeys.Add(3, tempVirKeys);tempVirKeys = new List<VirKeyValue>{new VirKeyValue("Shift","LeftShift", width140, height1),new VirKeyValue("Z","Z",width1, height1),new VirKeyValue("X","X",width1, height1),new VirKeyValue("C","C",width1, height1),new VirKeyValue("V","V",width1, height1),new VirKeyValue("B","B",width1, height1),new VirKeyValue("N","N",width1, height1),new VirKeyValue("M","M",width1, height1),new VirKeyValue("<\n,","Comma", width1, height1),new VirKeyValue(">\n.","Period", width1, height1),new VirKeyValue("?\n/","Slash", width1, height1),new VirKeyValue("Shift","RightControl", width140, height1),new VirKeyValue("↑","UpArrow", width1, height1),new VirKeyValue("1","Keypad1", width1, height1),new VirKeyValue("2","Keypad2", width1, height1),new VirKeyValue("3","Keypad3", width1, height1),};dicVirKeys.Add(4, tempVirKeys);tempVirKeys = new List<VirKeyValue>{new VirKeyValue("Ctrl","LeftControl", width2, height1),new VirKeyValue("Win", "LeftWindows",width1, height1),new VirKeyValue("Alt", "LeftAlt",width1, height1),new VirKeyValue("—————Space———","Space", width3, height1),new VirKeyValue("Alt", "RightAlt",width1, height1),new VirKeyValue("Ctrl", "RightControl",width2, height1),new VirKeyValue("←","LeftArrow",width1, height1),new VirKeyValue("↓","DownArrow",width1, height1),new VirKeyValue("→","RightArrow",width1, height1),new VirKeyValue("0","Keypad0",width100, height1),new VirKeyValue(".","KeypadPeriod",width1, height1),};dicVirKeys.Add(5, tempVirKeys);}}

整体代码如下:

using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;// 键盘映射value值
public class VirKeyValue
{public float height;public float width;public string name;public string key;public VirKeyValue(string name, string key, float width, float height){this.name = name;this.width = width;this.height = height;this.key = key;}
}
public class VirtualKeyboardEditor : EditorWindow
{[MenuItem("工具/键盘映射值")]static void OpenWindow(){GetWindow<VirtualKeyboardEditor>().Show();}static Dictionary<int, List<VirKeyValue>> dicVirKeys;const int width1 = 50;const int width2 = 80;const int width100 = 100;const int width120 = 120;const int width140 = 138;const int width3 = 300;const int height1 = 30;private void DataInit(){if (dicVirKeys == null){dicVirKeys = new Dictionary<int, List<VirKeyValue>>();List<VirKeyValue> tempVirKeys = new List<VirKeyValue>{new VirKeyValue("Esc","Esc", width1, height1),new VirKeyValue("F1","F1", width1, height1),new VirKeyValue("F2","F2", width1, height1),new VirKeyValue("F3","F3", width1, height1),new VirKeyValue("F4","F4", width1, height1),new VirKeyValue("F5","F5", width1, height1),new VirKeyValue("F6","F6", width1, height1),new VirKeyValue("F7","F7", width1, height1),new VirKeyValue("F8","F8", width1, height1),new VirKeyValue("F9","F9", width1, height1),new VirKeyValue("F10","F10", width1, height1),new VirKeyValue("F11","F11", width1, height1),new VirKeyValue("F12","F12", width1, height1),new VirKeyValue("Print\nScreen","Print", width1, height1),new VirKeyValue("Scroll\nLock", "ScrollLockScroll",width1, height1),new VirKeyValue("Pause","Pause", width1, height1)};dicVirKeys.Add(0, tempVirKeys);tempVirKeys = new List<VirKeyValue>{new VirKeyValue("~\n`","BackQuote", width1, height1),new VirKeyValue("!\n1","Alpha1", width1, height1),new VirKeyValue("@\n2","Alpha2", width1, height1),new VirKeyValue("#\n3","Alpha3", width1, height1),new VirKeyValue("$\n4","Alpha4", width1, height1),new VirKeyValue("%\n5","Alpha5", width1, height1),new VirKeyValue("^\n6","Alpha6", width1, height1),new VirKeyValue("&\n7","Alpha7", width1, height1),new VirKeyValue("*\n8","Alpha8", width1, height1),new VirKeyValue("(\n9","Alpha9", width1, height1),new VirKeyValue(")\n0","Alpha0", width1, height1),new VirKeyValue("_\n-","Minus", width1, height1),new VirKeyValue("+\n=","Equals", width1, height1),new VirKeyValue("←Backspace","Backspace", width120, height1),new VirKeyValue("Insert","Insert", width1, height1),new VirKeyValue("Home", "Home",width1, height1),new VirKeyValue("Page\nUp", "PageUp",width1, height1),new VirKeyValue("NumLk","Numlock", width1, height1),new VirKeyValue("/","KeypadDivide", width1, height1),new VirKeyValue("*","KeypadMultiply", width1, height1),new VirKeyValue("-","KeypadMinus", width1, height1),};dicVirKeys.Add(1, tempVirKeys);tempVirKeys = new List<VirKeyValue>{new VirKeyValue("Tab","Tab", width100, height1),new VirKeyValue("Q","Q",width1, height1),new VirKeyValue("W","W",width1, height1),new VirKeyValue("E","E",width1, height1),new VirKeyValue("R","R",width1, height1),new VirKeyValue("T","T",width1, height1),new VirKeyValue("Y","Y",width1, height1),new VirKeyValue("U","U",width1, height1),new VirKeyValue("I","I",width1, height1),new VirKeyValue("O","O",width1, height1),new VirKeyValue("P","P",width1, height1),new VirKeyValue("{\n[","LeftBracket", width1, height1),new VirKeyValue("}\n]","RightBracket", width1, height1),new VirKeyValue("|\n\\", "Backslash",70, height1),new VirKeyValue("Delete", "Delete",width1, height1),new VirKeyValue("End", "End",width1, height1),new VirKeyValue("Page\nDown","PageDown", width1, height1),new VirKeyValue("7","Keypad7",width1, height1),new VirKeyValue("8","Keypad8",width1, height1),new VirKeyValue("9","Keypad9",width1, height1),new VirKeyValue("+","KeypadPlus",width1, height1),};dicVirKeys.Add(2, tempVirKeys);tempVirKeys = new List<VirKeyValue>{new VirKeyValue("Caps\nLock","Backspace", width120, height1),new VirKeyValue("A","A", width1, height1),new VirKeyValue("S","S", width1, height1),new VirKeyValue("D","D", width1, height1),new VirKeyValue("F","F", width1, height1),new VirKeyValue("G","G", width1, height1),new VirKeyValue("H","H", width1, height1),new VirKeyValue("J","J", width1, height1),new VirKeyValue("K","K", width1, height1),new VirKeyValue("L","L", width1, height1),new VirKeyValue(":\n;","Semicolon", width1, height1),new VirKeyValue("\"\n'","Quote", width1, height1),new VirKeyValue("Enter","Enter", 104, height1),new VirKeyValue("4","Keypad4",width1, height1),new VirKeyValue("5","Keypad5",width1, height1),new VirKeyValue("6","Keypad6",width1, height1),new VirKeyValue("Enter","KeypadEnter", width1, height1),};dicVirKeys.Add(3, tempVirKeys);tempVirKeys = new List<VirKeyValue>{new VirKeyValue("Shift","LeftShift", width140, height1),new VirKeyValue("Z","Z",width1, height1),new VirKeyValue("X","X",width1, height1),new VirKeyValue("C","C",width1, height1),new VirKeyValue("V","V",width1, height1),new VirKeyValue("B","B",width1, height1),new VirKeyValue("N","N",width1, height1),new VirKeyValue("M","M",width1, height1),new VirKeyValue("<\n,","Comma", width1, height1),new VirKeyValue(">\n.","Period", width1, height1),new VirKeyValue("?\n/","Slash", width1, height1),new VirKeyValue("Shift","RightControl", width140, height1),new VirKeyValue("↑","UpArrow", width1, height1),new VirKeyValue("1","Keypad1", width1, height1),new VirKeyValue("2","Keypad2", width1, height1),new VirKeyValue("3","Keypad3", width1, height1),};dicVirKeys.Add(4, tempVirKeys);tempVirKeys = new List<VirKeyValue>{new VirKeyValue("Ctrl","LeftControl", width2, height1),new VirKeyValue("Win", "LeftWindows",width1, height1),new VirKeyValue("Alt", "LeftAlt",width1, height1),new VirKeyValue("—————Space———","Space", width3, height1),new VirKeyValue("Alt", "RightAlt",width1, height1),new VirKeyValue("Ctrl", "RightControl",width2, height1),new VirKeyValue("←","LeftArrow",width1, height1),new VirKeyValue("↓","DownArrow",width1, height1),new VirKeyValue("→","RightArrow",width1, height1),new VirKeyValue("0","Keypad0",width100, height1),new VirKeyValue(".","KeypadPeriod",width1, height1),};dicVirKeys.Add(5, tempVirKeys);}}//用于绘制窗口内容private void OnGUI(){}
}

2-2、界面绘制

using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;// 键盘映射value值
public class VirKeyValue
{public float height;public float width;public string name;public string key;public VirKeyValue(string name, string key, float width, float height){this.name = name;this.width = width;this.height = height;this.key = key;}
}
public class VirtualKeyboardEditor : EditorWindow
{[MenuItem("工具/键盘映射值")]static void OpenWindow(){GetWindow<VirtualKeyboardEditor>().Show();}static Dictionary<int, List<VirKeyValue>> dicVirKeys;const int width1 = 50;const int width2 = 80;const int width100 = 100;const int width120 = 120;const int width140 = 138;const int width3 = 300;const int height1 = 30;private void DataInit(){if (dicVirKeys == null){dicVirKeys = new Dictionary<int, List<VirKeyValue>>();List<VirKeyValue> tempVirKeys = new List<VirKeyValue>{new VirKeyValue("Esc","Esc", width1, height1),new VirKeyValue("F1","F1", width1, height1),new VirKeyValue("F2","F2", width1, height1),new VirKeyValue("F3","F3", width1, height1),new VirKeyValue("F4","F4", width1, height1),new VirKeyValue("F5","F5", width1, height1),new VirKeyValue("F6","F6", width1, height1),new VirKeyValue("F7","F7", width1, height1),new VirKeyValue("F8","F8", width1, height1),new VirKeyValue("F9","F9", width1, height1),new VirKeyValue("F10","F10", width1, height1),new VirKeyValue("F11","F11", width1, height1),new VirKeyValue("F12","F12", width1, height1),new VirKeyValue("Print\nScreen","Print", width1, height1),new VirKeyValue("Scroll\nLock", "ScrollLockScroll",width1, height1),new VirKeyValue("Pause","Pause", width1, height1)};dicVirKeys.Add(0, tempVirKeys);tempVirKeys = new List<VirKeyValue>{new VirKeyValue("~\n`","BackQuote", width1, height1),new VirKeyValue("!\n1","Alpha1", width1, height1),new VirKeyValue("@\n2","Alpha2", width1, height1),new VirKeyValue("#\n3","Alpha3", width1, height1),new VirKeyValue("$\n4","Alpha4", width1, height1),new VirKeyValue("%\n5","Alpha5", width1, height1),new VirKeyValue("^\n6","Alpha6", width1, height1),new VirKeyValue("&\n7","Alpha7", width1, height1),new VirKeyValue("*\n8","Alpha8", width1, height1),new VirKeyValue("(\n9","Alpha9", width1, height1),new VirKeyValue(")\n0","Alpha0", width1, height1),new VirKeyValue("_\n-","Minus", width1, height1),new VirKeyValue("+\n=","Equals", width1, height1),new VirKeyValue("←Backspace","Backspace", width120, height1),new VirKeyValue("Insert","Insert", width1, height1),new VirKeyValue("Home", "Home",width1, height1),new VirKeyValue("Page\nUp", "PageUp",width1, height1),new VirKeyValue("NumLk","Numlock", width1, height1),new VirKeyValue("/","KeypadDivide", width1, height1),new VirKeyValue("*","KeypadMultiply", width1, height1),new VirKeyValue("-","KeypadMinus", width1, height1),};dicVirKeys.Add(1, tempVirKeys);tempVirKeys = new List<VirKeyValue>{new VirKeyValue("Tab","Tab", width100, height1),new VirKeyValue("Q","Q",width1, height1),new VirKeyValue("W","W",width1, height1),new VirKeyValue("E","E",width1, height1),new VirKeyValue("R","R",width1, height1),new VirKeyValue("T","T",width1, height1),new VirKeyValue("Y","Y",width1, height1),new VirKeyValue("U","U",width1, height1),new VirKeyValue("I","I",width1, height1),new VirKeyValue("O","O",width1, height1),new VirKeyValue("P","P",width1, height1),new VirKeyValue("{\n[","LeftBracket", width1, height1),new VirKeyValue("}\n]","RightBracket", width1, height1),new VirKeyValue("|\n\\", "Backslash",70, height1),new VirKeyValue("Delete", "Delete",width1, height1),new VirKeyValue("End", "End",width1, height1),new VirKeyValue("Page\nDown","PageDown", width1, height1),new VirKeyValue("7","Keypad7",width1, height1),new VirKeyValue("8","Keypad8",width1, height1),new VirKeyValue("9","Keypad9",width1, height1),new VirKeyValue("+","KeypadPlus",width1, height1),};dicVirKeys.Add(2, tempVirKeys);tempVirKeys = new List<VirKeyValue>{new VirKeyValue("Caps\nLock","Backspace", width120, height1),new VirKeyValue("A","A", width1, height1),new VirKeyValue("S","S", width1, height1),new VirKeyValue("D","D", width1, height1),new VirKeyValue("F","F", width1, height1),new VirKeyValue("G","G", width1, height1),new VirKeyValue("H","H", width1, height1),new VirKeyValue("J","J", width1, height1),new VirKeyValue("K","K", width1, height1),new VirKeyValue("L","L", width1, height1),new VirKeyValue(":\n;","Semicolon", width1, height1),new VirKeyValue("\"\n'","Quote", width1, height1),new VirKeyValue("Enter","Enter", 104, height1),new VirKeyValue("4","Keypad4",width1, height1),new VirKeyValue("5","Keypad5",width1, height1),new VirKeyValue("6","Keypad6",width1, height1),new VirKeyValue("Enter","KeypadEnter", width1, height1),};dicVirKeys.Add(3, tempVirKeys);tempVirKeys = new List<VirKeyValue>{new VirKeyValue("Shift","LeftShift", width140, height1),new VirKeyValue("Z","Z",width1, height1),new VirKeyValue("X","X",width1, height1),new VirKeyValue("C","C",width1, height1),new VirKeyValue("V","V",width1, height1),new VirKeyValue("B","B",width1, height1),new VirKeyValue("N","N",width1, height1),new VirKeyValue("M","M",width1, height1),new VirKeyValue("<\n,","Comma", width1, height1),new VirKeyValue(">\n.","Period", width1, height1),new VirKeyValue("?\n/","Slash", width1, height1),new VirKeyValue("Shift","RightControl", width140, height1),new VirKeyValue("↑","UpArrow", width1, height1),new VirKeyValue("1","Keypad1", width1, height1),new VirKeyValue("2","Keypad2", width1, height1),new VirKeyValue("3","Keypad3", width1, height1),};dicVirKeys.Add(4, tempVirKeys);tempVirKeys = new List<VirKeyValue>{new VirKeyValue("Ctrl","LeftControl", width2, height1),new VirKeyValue("Win", "LeftWindows",width1, height1),new VirKeyValue("Alt", "LeftAlt",width1, height1),new VirKeyValue("—————Space———","Space", width3, height1),new VirKeyValue("Alt", "RightAlt",width1, height1),new VirKeyValue("Ctrl", "RightControl",width2, height1),new VirKeyValue("←","LeftArrow",width1, height1),new VirKeyValue("↓","DownArrow",width1, height1),new VirKeyValue("→","RightArrow",width1, height1),new VirKeyValue("0","Keypad0",width100, height1),new VirKeyValue(".","KeypadPeriod",width1, height1),};dicVirKeys.Add(5, tempVirKeys);}}//用于绘制窗口内容private void OnGUI(){DataInit();GUILayout.Label("Note:在开发中会遇到使用监控键盘输入的情况,但是KeyCode的值往往分不清楚,此工具就是跟键盘一一对应的Key值,不清楚的时候" +"看一眼就行了,当然,也可以点击按钮,点击后可以打印当前KeyCode值。");for (int i = 0; i < dicVirKeys.Count; i++){GUILayout.BeginVertical();OnRow(i);GUILayout.EndVertical();}}void OnRow(int index){GUILayout.BeginHorizontal();for (int i = 0; i < dicVirKeys[index].Count; i++){if (dicVirKeys[index][i].name == "↑"){GUILayout.Space(50);}else if (dicVirKeys[index][i].name == "←"){GUILayout.Space(180);}else if (dicVirKeys[index][i].name == "4"){GUILayout.Space(160);}else if (dicVirKeys[index][i].name == "1"){GUILayout.Space(60);}else if (dicVirKeys[index][i].name == "0"){GUILayout.Space(6);}GUILayout.BeginVertical();if (GUILayout.Button(dicVirKeys[index][i].name, GUILayout.Width(dicVirKeys[index][i].width), GUILayout.Height(dicVirKeys[index][i].height))){Debug.Log("当前按下的键位是 : KeyCode." + dicVirKeys[index][i].key);}GUILayout.Label(dicVirKeys[index][i].key);GUILayout.EndVertical();if (dicVirKeys[index][i].name == "Esc"){GUILayout.Space(52);}else if (dicVirKeys[index][i].name == "F4"){GUILayout.Space(36);}else if (dicVirKeys[index][i].name == "F8"){GUILayout.Space(36);}}GUILayout.EndHorizontal();}
}

然后在Untiy编辑器的Edit栏,选择工具→键盘映射值打开面板:
在这里插入图片描述

三、后记

如果觉得本篇文章有用别忘了点个关注,关注不迷路,持续分享更多Unity干货文章。


你的点赞就是对博主的支持,有问题记得留言:

博主主页有联系方式。

博主还有跟多宝藏文章等待你的发掘哦:

专栏方向简介
Unity3D开发小游戏小游戏开发教程分享一些使用Unity3D引擎开发的小游戏,分享一些制作小游戏的教程。
Unity3D从入门到进阶入门从自学Unity中获取灵感,总结从零开始学习Unity的路线,有C#和Unity的知识。
Unity3D之UGUIUGUIUnity的UI系统UGUI全解析,从UGUI的基础控件开始讲起,然后将UGUI的原理,UGUI的使用全面教学。
Unity3D之读取数据文件读取使用Unity3D读取txt文档、json文档、xml文档、csv文档、Excel文档。
Unity3D之数据集合数据集合数组集合:数组、List、字典、堆栈、链表等数据集合知识分享。
Unity3D之VR/AR(虚拟仿真)开发虚拟仿真总结博主工作常见的虚拟仿真需求进行案例讲解。
Unity3D之插件插件主要分享在Unity开发中用到的一些插件使用方法,插件介绍等
Unity3D之日常开发日常记录主要是博主日常开发中用到的,用到的方法技巧,开发思路,代码分享等
Unity3D之日常BUG日常记录记录在使用Unity3D编辑器开发项目过程中,遇到的BUG和坑,让后来人可以有些参考。

相关文章:

【Unity3D编辑器开发】Unity3D中制作一个可以随时查看键盘对应KeyCode值面板,方便开发

推荐阅读 CSDN主页GitHub开源地址Unity3D插件分享简书地址我的个人博客 大家好&#xff0c;我是佛系工程师☆恬静的小魔龙☆&#xff0c;不定时更新Unity开发技巧&#xff0c;觉得有用记得一键三连哦。 一、前言 在开发中&#xff0c;会遇到要使用监控键盘输入的KeyCode值来执…...

VUE echarts 柱状图、折线图 双Y轴 显示

weekData: [“1周”,“2周”,“3周”,“4周”,“5周”,“6周”,“7周”,“8周”,“9周”,“10周”], //柱状图横轴 jdslData: [150, 220, 430, 360, 450, 680, 100, 450, 680, 200], // 折线图的数据 cyslData: [100, 200, 400, 300, 500, 500, 500, 450, 480, 400], // 柱状图…...

Django开发之基础篇

Django基础篇 一、Django学习之路由二、Django学习之视图三、Django学习之静态资源 一、Django学习之路由 在 Django 中&#xff0c;路由&#xff08;URL 映射&#xff09;是将请求与视图函数关联起来的关键部分。路由定义了如何将特定的 URL 请求映射到 Django 应用程序中的视…...

在 centos7 上安装Docker

1、检查linux内核 Docker 运行在 CentOS 7 上&#xff0c;要求系统为64位、系统内核版本为 3.10 以上。 Docker 运行在 CentOS-6.5 或更高的版本的 CentOS 上&#xff0c;要求系统为64位、系统内核版本为 2.6.32-431 或者更高版本。 uname -r 2、使用 root 权限登录 Centos…...

基于SpringBoot的大学城水电管理系统

目录 前言 一、技术栈 二、系统功能介绍 管理员模块的实现 领用设备管理 消耗设备管理 设备申请管理 状态汇报管理 用户模块的实现 设备申请 状态汇报 用户反馈 三、核心代码 1、登录模块 2、文件上传模块 3、代码封装 前言 随着信息技术在管理上越来越深入而广泛…...

微信小程序 movable-view 控制长按才触发拖动 轻轻滑动页面正常滚动效果

今天写 movable-areamovable-view遇到了个头疼的问题 那就是 movable-view 监听了用户拖拽自己 但 我们小程序 上下滚动页面靠的也是拖拽 也就是说 如果放在这里 用户拖动 movable-view部分 就会永远触发不了滚动 那么 我们先可以 加一个 bindlongpress"longpressHandler…...

mysql面试题27:数据库中间件了解过吗?什么是sharding jdbc、mycat,并且讲讲怎么使用?

该文章专注于面试,面试只要回答关键点即可,不需要对框架有非常深入的回答,如果你想应付面试,是足够了,抓住关键点 面试官:数据库中间件了解过吗,比如sharding jdbc、mycat? 我知道的数据库中间件有以下这些: MySQL Proxy:MySQL Proxy是一个开源的数据库中间件,它位…...

DBCO Sata650,二苯并环辛烷Sata650,Seta-650-DBCO

产品简介&#xff1a; CAS号&#xff1a;N/A 中文名&#xff1a;二苯并环辛烷Sata650 英文名&#xff1a;DBCO Sata650,Seta-650-DBCO 化学式&#xff1a;N/A 分子量&#xff1a;1431.85 纯度标准&#xff1a;95% 供应商&#xff1a;陕西新研博美生物科技有限公司 存储…...

JFLASH基本使用总结

注意&#xff0c;不同版本的操作略有不同&#xff0c;本教程以J-Flash V5.12f为例。 烧录文件 如果是刚打开J-Flash&#xff0c;会弹出这样的一个工程选择界面&#xff0c;可以选择已有工程&#xff0c;或者创建新的工程&#xff0c;我们这里选择创建新工程。 注意&#xff0…...

具身智能(Embodied AI)

前言 图灵奖得主、上海期智研究院院长姚期智认为&#xff0c;人工智能领域下一个挑战将是实现“具身通用人工智能”&#xff0c;即如何构建能够通过自我学习掌握各种技能并执行现实生活中的种种通用任务的高端机器人。清华大学计算机系教授张钹院士&#xff0c;也在某产业智能论…...

C语言的文件写入、读取

目标1&#xff1a;使用C语言的文件操作来实现一次性将输入的数据转换为字符串写入文件&#xff0c;然后逐行读取并进行操作。 模板 #include <stdio.h>int main() {// 打开文件以写入数据FILE *file fopen("data.txt", "w");if (file NULL) {pri…...

CART 算法——决策树

目录 1.CART的生成&#xff1a; &#xff08;1&#xff09;回归树的生成 &#xff08;2&#xff09;分类树的生成 ①基尼指数 ②算法步骤 2.CART剪枝&#xff1a; &#xff08;1&#xff09;损失函数 &#xff08;2&#xff09;算法步骤&#xff1a; CART是英文“class…...

CF1877A Goals of Victory

题目是说&#xff0c;有n个队伍进行足球赛&#xff0c;两两之间进行一场足球赛&#xff0c;会有一个积分&#xff0c;a:b&#xff0c;题目所说的efficiency表示的是一个队伍的得分减去对手队伍的得分 #include<bits/stdc.h> using namespace std;int num[110];int main(…...

018-第三代软件开发-整体介绍

第三代软件开发-整体介绍 文章目录 第三代软件开发-整体介绍项目介绍整体介绍Qt 属性系统QML 最新软件技术框架 关键字&#xff1a; Qt、 Qml、 属性、 Qml 软件架构 项目介绍 欢迎来到我们的 QML & C 项目&#xff01;这个项目结合了 QML&#xff08;Qt Meta-Object …...

储存数据文本json的读写

系列文章目录 提示:这里可以添加系列文章的所有文章的目录,目录需要自己手动添加 TODO:写完再整理 文章目录 系列文章目录前言一、json文本介绍二、json文本的应用三、json文本的操作1、环境配置2、写入文件3、读取文件4、文件格式解析注意的点参考链接前言 认知有限,望大家…...

Java之动态代理的详细解析

2. 动态代理 2.1 好处&#xff1a; 无侵入式的给方法增强功能 2.2 动态代理三要素&#xff1a; 1&#xff0c;真正干活的对象 2&#xff0c;代理对象 3&#xff0c;利用代理调用方法 切记一点&#xff1a;代理可以增强或者拦截的方法都在接口中&#xff0c;接口需要写在…...

github Release 下载加速,绿色合法,遥遥领先

你有没有这样一个困惑&#xff0c;当你寻找了很久终于找到一个解决问题的方案&#xff0c;发现这个工具在 GitHub 上&#xff0c;接下来等待我们的就是遥遥无期的龟速下载。 文章目录 前言下载测试加速下载操作 视频讲解 遥遥领先 前言 GitHub 作为程序员的知识宝库&#xff…...

RabbitMQ消息中间件概述

1.什么是RabbitMQ RabbitMQ是一个由erlang开发的AMQP&#xff08;Advanced Message Queue &#xff09;的开源实现。AMQP 的出现其实也是应了广大人民群众的需求&#xff0c;虽然在同步消息通讯的世界里有很多公开标准&#xff08;如 COBAR的 IIOP &#xff0c;或者是 SOAP 等&…...

12V手电钻保护板如何接线演示

爱做手工的小伙伴们肯定会用到手电钻&#xff0c;那么电池消耗完了&#xff0c;或要换的&#xff0c;或要自己动手做几个备用电源&#xff0c;关键点就是电路保护板的接线。废话不多说&#xff0c;直接上板子看实操。 文章目录 一、线路板图1、输入接线2、输出接线 二、接线方法…...

基于SpringBoot的教学辅助平台

目录 前言 一、技术栈 二、系统功能介绍 学生信息管理 教师信息管理 课程信息管理 科目分类管理 班级分类管理 课程作业管理 交流论坛管理 三、核心代码 1、登录模块 2、文件上传模块 3、代码封装 前言 随着信息技术在管理上越来越深入而广泛的应用&#xff0c;管理…...

Qt 读写数据流文件(转 CppGuiProgrammingWithQt4)

读取文件&#xff1a; update 20140525&#xff1a;添加线程处理&#xff0c;在读取大文件时优化&#xff0c;防止 app 出现 application 假死状态。 bool SpreadSheet::readFile(const QString &filePath){QFile file(filePath);if ( !file.open(QIODevice::ReadOnly)) …...

Pygame中将鼠标形状设置为图片2-2

3 编写主程序 在主程序中&#xff0c;首先创建屏幕并且完成一些准备工作&#xff0c;之后在while循环中不断更新sprite实例即可。 3.1 创建屏幕及准备工作 创建屏幕及准备工作的代码如图5所示。 图5 创建屏幕及准备工作 其中&#xff0c;第20行代码调用pygame.mouse模块中的…...

GPU 基础知识整理

萌新&#xff1a; 在接触一款硬件时我会&#xff1a;基础硬件结构&#xff0c;线程结构&#xff0c;内存布局&#xff0c;数据吞吐量&#xff0c;等方面进行学习 首先GPU的特点: 并行性能&#xff1a;GPU 是专门设计用于并行计算的硬件&#xff0c;通常具有大量的处理单元&am…...

stable diffusion API接口 + 扩展接口

文章目录 概要流程页面接口调用展示txt2img接口AutoDL设置扩展接口 概要 调研Stable Diffusion二次开发&#xff0c;查看接口文档。 基于AutoDL算力服务器&#xff0c;直接安装部署&#xff0c;非常容易上手&#xff0c;部署教程放下面了。 部署教程 流程 页面接口调用 页面…...

MySQL数据库基本操作和完整性约束类型详解

目录 一、增删改查的sql语句二、表完整性约束1、表完整性约束的介绍2、常见的完整性约束类型3、表完整性约束实战操作3.1.主键primary key3.2.自增键auto_increment3.3.唯一键UNIQUE3.4.null与not null3.5.默认约束 一、增删改查的sql语句 SQL&#xff08;Structured Query Lan…...

unity2022版本 实现加减进度条

简介 在现代游戏开发中&#xff0c;用户界面 (UI) 扮演着至关重要的角色&#xff0c;它不仅为玩家提供信息&#xff0c;还增强了游戏的可玩性。加减进度条是一种常见的UI元素&#xff0c;它可以用于显示游戏中的进度、倒计时、资源管理和其他关键信息。在这篇博客中&#xff0…...

COCO数据集中图像的caption读取到txt文件

annotations_trainval2017.zip import os import shutil import jsoncaptions_path r"G:\SketchDiffusion\Sketchycoco\Dataset\annotations\captions_train2017.json" # 读取json文件 with open(captions_path, r) as f1:dictortary json.load(f1)# 得到images和…...

再谈Java泛型

一.类型参数的约束 我们可以对泛型传进来的参数做一些约束&#xff0c;比如说 用extends表明传进来的参数类型必须是必须是某个类型的子类型或者本身 当然也可以用接口约束&#xff0c;也是用extends表明传进来的参数类型必须实现某个接口。用&连接&#xff0c;注意class…...

scss使用自定义函数实现单位像素随屏幕比例动态缩放

vue中通过变量和scss函数来动态实现动态缩放像素 简单来说就是比例缩小时&#xff0c;像素单位变大&#xff0c;从而字体大小相对不变&#xff0c;以下仅处理比例缩小的状况 自定义一个属性–size&#xff0c;初始值为1px template <template><div class"hom…...

Django 静态自定义化配置

STATIC # APP本地静态资源目录&#xff08;就APP对应的&#xff09; STATIC_URL "/static/"# 远程静态文件URL&#xff08;少用&#xff09; REMOTE_STATIC_URL# 外部引用静态文件目录&#xff08;外层的&#xff09; STATICFILES_DIRS [os.path.join(BASE_DIR, &…...