Unreal Engine 4 —— 键位更换以及对应思考

本文探讨了在Unreal Engine 4 (UE4) 中实现键位更换的方法,包括键位配置的持久化、输入设备切换、组合键的处理以及Axis与Action的统一。通过分析和解决前置问题,如键位是否保存到存档,如何处理组合键,以及如何处理不同设备的输入差异,提供了具体实现的示例代码。同时,文章提醒开发者注意避免静态存储PlayerController实例可能导致的问题。
摘要由CSDN通过智能技术生成

这篇博客介绍了如何在UE4中实现更换键位的方法。


介绍

在大多数的PC游戏中,为了适应大多数玩家,往往会提供键位设置的接口。虽然也有例如生化危机系列游戏提供的是几个输入类型供玩家自己选择,然而还是自定义输入的方法更加普遍。

需要注意的是,很多的PC游戏的输入控制都是即支持手柄,又支持键盘\鼠标操控的。但是往往要么只启用手柄操作,要么只启用键盘\鼠标操作。关于这一块的详细内容可以参考我以前的博客:游戏输入控制的五条黄金法则

前置问题

在了解虚幻4的键位更换功能之前,首先要思考一些问题,这些问题确定了之后,才能进一步的去实现键位的更换功能。

  • 键位配置是否写入存档?持久化保存该如何进行?
    UE4的键位配置是默认读取对应的Input.ini文件的,因此在进行键位配置的时候,比较通用的方法是写入对应的ini文件。但是如果键位配置写入存档就是另一套方法了,甚至不需要进行持久化的保存。

  • 输入设备的切换该如何抉择?
    参考我以前的博客:游戏输入控制的五条黄金法则

  • 组合键?
    UE4内置的组合键有ctrlshiftcmdalt,这些键可以与普通按键进行组合。在项目中是否需要进行这些组合键的应用?

  • Axis与Action的归一?
    手柄的摇杆Axis通常对应着

Unreal Engine 4 for Beginners, as its name implies, is specifically written with the beginner in mind. It is meant for those who wish to learn how to make video games with no prior game development, game design, or game programming experience. It concentrates on the fundamentals, in order to build a rock solid foundation upon which the reader can use to confidently explore more intermediate and advanced topics. It provides a thorough examination of the basics, covering each subject in fine detail. Great care has been taken to ad vance through the subject matter in an order that best ensures that everything needed to understand one piece of information has already been covered in the information prior. It makes a great textbook for an Intro to Unreal Engine, or Unreal Engine 101 course. In addition, the book has been formatted specifically for ease of use with tablets and other mobile devices. The book concentrates heavily on four key areas: Environments - Construct beautiful environments with moving objects and sounds Inputs - Enter and explore the worlds you construct by creating a Character and specifying how it can move and how to control those movements Menus & Displays - Learn how to create the user interfaces and on-screen displays that will enhance your game and bring it to the next level Logic - Learn how to construct logic and take full control over the first three subject areas. How should objects in your world move? What should cause a certain sound to play? How does the player win the game? You decide! No need to wait for shipping! Get started learning the fundamentals of game development right now with this specially formatted ebook textbook! Table of Contents Chapter 1 Getting Started Chapter 2 Basic Concepts Chapter 3 The Level Editor Chapter 4 Actors Chapter 5 Blueprints Chapter 6 Players & Input Chapter 7 Collisions Chapter 8 User Interfaces Chapter 9 Audio Chapter 10 Additional Topics Book Details QR code for Unreal Engine 4 for Beginners Title: Unreal Engine 4 for Beginners 收缩
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值