系统引入日志包_引入新的输入系统

系统引入日志包

Update: The Input System is now verified for Unity 2019 LTS and later. The Input System is available in preview for Unity 2019.1 and later. This new system focuses on ease of use and consistency across devices and platforms. Install it via the Package Manager, give it a try, and join us on the forums with any feedback you have.

更新: 输入系统现已通过Unity 2019 LTS及更高版本的验证。 输入系统可在Unity 2019.1及更高版本的预览中使用。 这个新系统侧重于设备和平台之间的易用性和一致性。 通过“程序包管理器”进行安装,尝试一下,然后将您的反馈与我们一起加入论坛

Unity’s current built-in input management system was designed before we supported the many platforms and devices that we do today. Over the years, we realized that it wasn’t very easy to use and, occasionally, it even struggled with simple situations – like plugging in a controller after the executable was launched. That’s why we have been working on something new; a complete rewrite. (P.S. There is currently no timeline for the removal of the current Input Manager.)

Unity的当前内置输入管理系统是在我们支持当今许多平台和设备之前设计的。 多年以来,我们意识到它并不是很容易使用,有时甚至遇到一些简单的情况-例如在可执行文件启动后插入控制器。 这就是为什么我们一直在努力进行新的工作。 完全重写。 (PS当前没有删除当前输入管理器的时间表。)

演示地址

系统引入日志包_引入新的输入系统

New technology has dramatically changed how we play and consume media in recent years. Every new wave of technology also brings new devices along with specific control requirements.

近年来,新技术极大地改变了我们播放和消费媒体的方式。 每一个新的技术浪潮也带来了新的设备以及特定的控制要求。

使用方便 (Ease of use)

The Input System’s new workflow is designed around a simple interface that works for all platforms, and can easily be extended to support custom or future devices.

Input System的新工作流程是围绕适用于所有平台的简单界面设计的,可以轻松扩展以支持定制或将来的设备。

The Action focused workflow is designed to separate the logical input your game code responds to from the physical actions the user takes. You can define Actions in the dedicated editor (or in a script) and bind them to both abstract and concrete inputs, such as the primary action of a Device or the left mouse button.

行动 的重点工作流程的设计你的游戏代码响应从用户采取物理动作分离的逻辑输入。 您可以在专用编辑器(或脚本)中定义动作,并将它们绑定到抽象输入和具体输入,例如 设备 的主要动作 或鼠标左键。

系统引入日志包_引入新的输入系统

Action Maps make it easy to manage many Actions across multiple Devices and Control Schemes.

动作图使跨多个设备和控制方案的许多动作管理变得容易。

Using the Input System’s PlayerInput component, you can easily link input actions to a GameObject and script action responses. This will work with any number of players in the game.

使用输入系统的PlayerInput组件,您可以轻松地将输入动作链接到GameObject和脚本动作响应。 这将适用于游戏中的任何数量的玩家。

系统引入日志包_引入新的输入系统

Use PlayerInput to set up input for a player.

使用PlayerInput设置玩家的输入。

Get callbacks when actions are performed:

执行动作时获取回调:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
public void OnMove(InputValue value)
{
    m_Move = value.Get<Vector2>();
}
public void OnLook(InputValue value)
{
    m_Look = value.Get<Vector2>();
}
public void OnFire()
{
    SpawnProjectile();
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
public void OnMove ( InputValue value )
{
     m_Move = value . Get < Vector2 > ( ) ;
}
public void OnLook ( InputValue value )
{
     m_Look = value . Get < Vector2 > ( ) ;
}
public void OnFire ( )
{
     SpawnProjectile ( ) ;
}

The new system supports an unlimited number and mix of devices. It also allows for notifications on device changes so you can properly support new devices at runtime.

新系统支持无限数量和混合的设备。 它还允许有关设备更改的通知,因此您可以在运行时正确支持新设备。

Note that console development requires installing additional packages. These can be obtained on each dedicated console forum where you would traditionally retrieve the Unity installer. See this list of Supported Input Devices for more details.

请注意,控制台开发需要安装其他软件包。 这些可以在每个传统的控制台论坛上获得,您通常可以在该论坛上检索Unity安装程序。 有关更多详细信息,请参见此支持的输入设备列表

客制化 (Customization)

The Input System is developed to be extensible, with APIs allowing you to support new Devices and to design your own Interactions, Input Processors, or even custom Binding setups. And in case you want to take a look under the hood, the package comes with complete source code and is developed on GitHub.

输入系统的开发具有可扩展性,其API使您可以支持新设备并设计自己的 InteractionsInput Processors 甚至自定义 绑定 设置。 并且如果您想了解一下,该软件包随附了完整的源代码,并在 GitHub上 开发 。

系统引入日志包_引入新的输入系统

Some of the default Interactions. You can easily create your own.

一些默认的交互。 您可以轻松创建自己的。

输入系统入门 (Getting started with the Input System)

Using Unity 2019.1 or later, open the Package Manager and enable Show Preview Packages in the Advanced menu. You will find the Input System package in the list of All Packages. Click Install in the upper right of the details panel. The current version is 1.0-preview. We’re working on getting the package verified for Unity 2020.1 and we’ll be adding new features afterwards.

使用Unity 2019.1或更高版本,打开包管理器并 在 高级 菜单中 启用 显示预览包 。 您将 在“ 所有软件包 ”列表中 找到“ 输入系统 ”软件包 。 单击 详细信息面板右上方的 安装 。 当前版本是1.0-preview。 我们正在努力为Unity 2020.1验证软件包,然后再添加新功能。

You may see a popup warning letting you know that you need to enable the new Input System backend. Click yes and restart the editor and you’ll be ready to go.

您可能会看到一个弹出警告,告知您需要启用新的输入系统后端。 单击是,然后重新启动编辑器,您就可以开始了。

Be sure to check out our Quick start guide, take a look at the samples that are installable through the Package Manager, and join us on the forums to give us your feedback. And in case you’d like to follow the active development, check out our GitHub repo.

请务必查看我们的 快速入门指南 ,查看可通过Package Manager安装的示例,并加入我们的 论坛 以提供反馈。 并且如果您想关注活跃的开发,请查看我们的 GitHub repo

翻译自: https://blogs.unity3d.com/2019/10/14/introducing-the-new-input-system/

系统引入日志包

相关文章:

  • 2021-08-03
  • 2021-09-18
  • 2021-04-20
  • 2021-10-05
  • 2021-06-17
猜你喜欢
  • 2021-10-17
  • 2021-12-14
  • 2022-12-23
  • 2021-06-01
  • 2021-12-29
  • 2022-12-23
相关资源
相似解决方案