Instantly share code, notes, and snippets.

Embed
What would you like to do?
Input Systemの簡易な運用
using UnityEngine;
using UnityEngine.Experimental.Input;
public class InputTest2 : MonoBehaviour
{
public InputAction mouseInput; // マウスの入力
public InputAction fireInput; // ボタンの入力
private void OnEnable()
{
mouseInput.Enable();
fireInput.Enable();
}
private void OnDisable()
{
mouseInput.Disable();
fireInput.Disable();
}
private void Awake()
{
mouseInput.performed += _ =>
{
var value = _.ReadValue<Vector2>();
Debug.LogFormat("pos:{0}, time:{1}", value, _.time);
};
fireInput.performed += _ =>
{
Debug.Log("Fire");
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment