Firstborn/Library/PackageCache/com.unity.inputsystem@1.5.1/Samples~/DocsExamples/ExampleDirect.cs

24 lines
473 B
C#
Raw Normal View History

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
}
}
}