IndieGame/client/Packages/com.unity.inputsystem@1.7.0/Samples~/DocsExamples/ExampleDirect.cs
DOBEST\zhaoyingjie f242607587 初始化工程
2024-10-11 10:12:15 +08:00

24 lines
473 B
C#

using UnityEngine;
using UnityEngine.InputSystem;
public class ExampleDirect : MonoBehaviour
{
void Update()
{
var gamepad = Gamepad.current;
if (gamepad == null)
{
return; // No gamepad connected.
}
if (gamepad.rightTrigger.wasPressedThisFrame)
{
// 'Use' code here
}
Vector2 move = gamepad.leftStick.ReadValue();
{
// 'Move' code here
}
}
}