这篇博客介绍了如何在UE4中实现更换键位的方法。
介绍
在大多数的PC游戏中,为了适应大多数玩家,往往会提供键位设置的接口。虽然也有例如生化危机系列游戏提供的是几个输入类型供玩家自己选择,然而还是自定义输入的方法更加普遍。
需要注意的是,很多的PC游戏的输入控制都是即支持手柄,又支持键盘\鼠标操控的。但是往往要么只启用手柄操作,要么只启用键盘\鼠标操作。关于这一块的详细内容可以参考我以前的博客:游戏输入控制的五条黄金法则
前置问题
在了解虚幻4的键位更换功能之前,首先要思考一些问题,这些问题确定了之后,才能进一步的去实现键位的更换功能。
键位配置是否写入存档?持久化保存该如何进行?
UE4的键位配置是默认读取对应的Input.ini
文件的,因此在进行键位配置的时候,比较通用的方法是写入对应的ini文件。但是如果键位配置写入存档就是另一套方法了,甚至不需要进行持久化的保存。输入设备的切换该如何抉择?
参考我以前的博客:游戏输入控制的五条黄金法则组合键?
UE4内置的组合键有ctrl
,shift
,cmd
与alt
,这些键可以与普通按键进行组合。在项目中是否需要进行这些组合键的应用?Axis与Action的归一?
手柄的摇杆Axis通常对应着