public static float GetAxisRaw (string axisName);

Description

返回由 axisName 标识的虚拟轴的值(未应用平滑过滤)。

对于键盘和游戏杆输入,该值将处于 -1...1 的范围内。 由于未对输入进行平滑处理,键盘输入将始终为 -1、0 或 1。 如果您想自己完成键盘输入的所有平滑处理,这非常有用。

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Update() { float speed = Input.GetAxisRaw("Horizontal") * Time.deltaTime; transform.Rotate(0, speed, 0); } }

The GetAxis page describes in detail what the axisName for GetAxisRaw means. For example the Horizontal axis is managed by Left and Right, and a and d keys. Other Input Axes can be seen in the Edit->Settings->Input window.